Advertisement
jayrock3401

Untitled

Dec 25th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.79 KB | None | 0 0
  1.  
  2. -- This script has been converted to FE by iPxter
  3.  
  4.  
  5. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  6. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  7. do
  8. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  9. script.Parent = Player.Character
  10.  
  11. --RemoteEvent for communicating
  12. local Event = Instance.new("RemoteEvent")
  13. Event.Name = "UserInput_Event"
  14.  
  15. --Fake event to make stuff like Mouse.KeyDown work
  16. local function fakeEvent()
  17. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  18. t.connect = t.Connect
  19. return t
  20. end
  21.  
  22. --Creating fake input objects with fake variables
  23. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  24. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  25. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  26. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  27. end}
  28. --Merged 2 functions into one by checking amount of arguments
  29. CAS.UnbindAction = CAS.BindAction
  30.  
  31. --This function will trigger the events that have been :Connect()'ed
  32. local function te(self,ev,...)
  33. local t = m[ev]
  34. if t and t._fakeEvent and t.Function then
  35. t.Function(...)
  36. end
  37. end
  38. m.TrigEvent = te
  39. UIS.TrigEvent = te
  40.  
  41. Event.OnServerEvent:Connect(function(plr,io)
  42. if plr~=Player then return end
  43. if io.isMouse then
  44. m.Target = io.Target
  45. m.Hit = io.Hit
  46. else
  47. local b = io.UserInputState == Enum.UserInputState.Begin
  48. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  49. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  50. end
  51. for _,t in pairs(CAS.Actions) do
  52. for _,k in pairs(t.Keys) do
  53. if k==io.KeyCode then
  54. t.Function(t.Name,io.UserInputState,io)
  55. end
  56. end
  57. end
  58. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  59. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  60. end
  61. end)
  62. Event.Parent = NLS([==[
  63. local Player = game:GetService("Players").LocalPlayer
  64. local Event = script:WaitForChild("UserInput_Event")
  65.  
  66. local UIS = game:GetService("UserInputService")
  67. local input = function(io,a)
  68. if a then return end
  69. --Since InputObject is a client-side instance, we create and pass table instead
  70. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  71. end
  72. UIS.InputBegan:Connect(input)
  73. UIS.InputEnded:Connect(input)
  74.  
  75. local Mouse = Player:GetMouse()
  76. local h,t
  77. --Give the server mouse data 30 times every second, but only if the values changed
  78. --If player is not moving their mouse, client won't fire events
  79. while wait(1/30) do
  80. if h~=Mouse.Hit or t~=Mouse.Target then
  81. h,t=Mouse.Hit,Mouse.Target
  82. Event:FireServer({isMouse=true,Target=t,Hit=h})
  83. end
  84. end]==],Player.Character)
  85. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  86. end
  87.  
  88. local c = {}
  89.  
  90. local n = Instance.new
  91. local t = type
  92. local ud = 'userdata'
  93.  
  94. function c:Part(P,s)
  95. local p = n('Part',P)
  96. p.formFactor = 'Custom'
  97. if t(s) == ud then p.Size = s
  98. elseif t(s) == 'table' then p.Size = Vector3.new(s[1],s[2],s[3]) end
  99. p:BreakJoints()
  100. return p
  101. end
  102.  
  103. function c:Part3(P,s)
  104. local p = c:Part(P,s)
  105. local m = n("SpecialMesh",p)
  106. m.MeshId = "rbxassetid://9856898"
  107. m.TextureId = "rbxassetid://48358980"
  108. p.Changed:connect(function()
  109. m.Scale = p.Size * 2
  110. end)
  111. return p,m
  112. end
  113.  
  114. Player = owner
  115.  
  116. pcall(function()
  117. Player.PlayerGui.G:Destroy()
  118. end)
  119.  
  120. function HSVtoRGB(h,s,v)
  121. local c = v * s
  122. local x = c * (1 - math.abs(h/60%2-1))
  123. local m = v - c
  124. local r = 0
  125. local g = 0
  126. local b = 0
  127. if h >= 0 and h < 60 then
  128. r = c ; g = x
  129. elseif h >= 60 and h < 120 then
  130. r = x ; g = c
  131. elseif h >= 120 and h < 180 then
  132. g = c ; b = x
  133. elseif h >= 180 and h < 240 then
  134. g = x ; b = c
  135. elseif h >= 240 and h < 300 then
  136. r = x ; b = c
  137. elseif h >= 300 and h < 360 then
  138. r = c ; b = x
  139. end
  140.  
  141. r = r+m
  142. g = g+m
  143. b = b+m
  144.  
  145. return r,g,b
  146. end
  147.  
  148. Screen = Instance.new("ScreenGui",Player.PlayerGui)
  149. Screen.Name = "G"
  150.  
  151. function TextLabel(Pa,S,Po,Color)
  152. local T = Instance.new("TextLabel",Pa)
  153. T.Size = S
  154. T.Position = Po
  155. T.BackgroundColor3 = Color
  156. T.Text = ""
  157. T.BorderSizePixel = 0
  158. return T
  159. end
  160.  
  161. function TextButton(Pa,S,Po,Color)
  162. local T = Instance.new("TextButton",Pa)
  163. T.Size = S
  164. T.Position = Po
  165. T.BackgroundColor3 = Color
  166. T.BorderColor3 = Color
  167. T.Text = ""
  168. return T
  169. end
  170.  
  171. function TextBox(Pa,S,Po,Color)
  172. local T = Instance.new("TextBox",Pa)
  173. T.Size = S
  174. T.Position = Po
  175. T.BackgroundColor3 = Color
  176. T.BorderColor3 = Color
  177. T.Text = ""
  178. return T
  179. end
  180.  
  181. function Frame(Pa,S,Po)
  182. local T = Instance.new("Frame",Pa)
  183. T.Size = S
  184. T.Position = Po
  185. T.BackgroundColor3 = Color3.new(1,1,1)
  186. T.BorderSizePixel = 0
  187. return T
  188. end
  189.  
  190. local BarScreen = Frame(Screen,UDim2.new(.15,0,2,0),UDim2.new(.888,0,-1,0))
  191. BarScreen.BackgroundTransparency = 0.5
  192.  
  193. local WS = Frame(Screen,UDim2.new(.172,0,.335,0),UDim2.new(.715,0,.665,0))
  194.  
  195. local TStick = 3
  196. local WantedColor = Color3.new(.5,.5,.8)
  197.  
  198. local MStick = {}
  199. local Angles = {
  200. {
  201. 185,0,0
  202. },
  203. {
  204. 0,1,0
  205. },
  206. {
  207. 0,0,0
  208. },
  209. {
  210. 0,0,0
  211. },
  212. {
  213. 0,0,0
  214. },
  215. {
  216. 0,0,0
  217. },
  218. {
  219. 0,0,0
  220. },
  221. }
  222.  
  223. function reVisible(Number)
  224. for i = 1,7 do
  225. if i > Number then
  226. MStick[i].Visible = false
  227. elseif i <= Number then
  228. MStick[i].Visible = true
  229. end
  230. end
  231. end
  232.  
  233. function CreateGeometry()
  234. Centre = Player.Character.Torso.CFrame
  235. pcall(function()
  236. Player.Character["Geometry"..Player.Name]:Destroy()
  237. end)
  238. local Boss = Instance.new("Model",Player.Character)
  239. Boss.Name = "Geometry"..Player.Name
  240. local OldPart = nil
  241. local FirstPart = nil
  242. local Parts = {}
  243. local MyAngles = {}
  244. local ModifyAngle = {}
  245. local MyCentre = Centre * CFrame.new(0,-3,0)
  246. local MyParent = Boss
  247.  
  248. for i,v in pairs(Angles) do
  249. table.insert(MyAngles,i,{})
  250. MyAngles[i][1] = v[1]
  251. MyAngles[i][2] = v[2]
  252. MyAngles[i][3] = v[3]
  253. end
  254.  
  255. for i = 1,TStick do
  256. local Part = Instance.new("Part",MyParent)
  257. table.insert(Parts,i,Part)
  258. Part.FormFactor = "Custom"
  259. Part.CanCollide = false
  260. Part.Anchored = true
  261. Part.Size = Vector3.new(.1,.1,5)
  262. if OldPart == nil then
  263. Part.CFrame = MyCentre
  264. FirstPart = Part
  265. else
  266. Part.CFrame = OldPart.CFrame + OldPart.CFrame.lookVector*Part.Size.Z/2
  267. end
  268. OldPart = Part
  269. Part.CFrame = Part.CFrame + Part.CFrame.lookVector*Part.Size.Z/2
  270. end
  271.  
  272. local ReachMax=false
  273.  
  274. for i = 1, #Parts do
  275. table.insert(ModifyAngle,i,{0,0,0})
  276. end
  277.  
  278. local OldPos = Parts[#Parts].CFrame + Parts[#Parts].CFrame.lookVector*Parts[#Parts].Size.Z/2
  279.  
  280. local co = 0
  281. repeat
  282. local StopTry=false
  283. for i,v in pairs(ModifyAngle) do
  284. v[1] = v[1] + MyAngles[i][1]
  285. v[2] = v[2] + MyAngles[i][2]
  286. v[3] = v[3] + MyAngles[i][3]
  287.  
  288. if i == 1 then
  289. Parts[i].CFrame = MyCentre* CFrame.Angles(math.rad(v[1]),math.rad(v[2]),math.rad(v[3]))
  290. else
  291. Parts[i].CFrame = (Parts[i-1].CFrame + Parts[i-1].CFrame.lookVector*Parts[i-1].Size.Z/2)
  292. Parts[i].CFrame = Parts[i].CFrame * CFrame.Angles(math.rad(v[1]),math.rad(v[2]),math.rad(v[3]))
  293. end
  294. Parts[i].CFrame = Parts[i].CFrame + Parts[i].CFrame.lookVector*Parts[i].Size.Z/2
  295. local NewPos = Parts[#Parts].CFrame + Parts[#Parts].CFrame.lookVector*Parts[#Parts].Size.Z/2
  296.  
  297. local L,M = c:Part3(MyParent,{.1,.1,(NewPos.p - OldPos.p).magnitude})
  298. local R,G,B = HSVtoRGB(co%360,1,1)
  299. L.FormFactor = "Custom"
  300. L.TopSurface = "Smooth"
  301. L.BottomSurface = "Smooth"
  302. L.CanCollide = true
  303. L.Anchored = true
  304. L.CFrame = NewPos:lerp(OldPos,.3)
  305. L.CFrame = CFrame.new(NewPos.p,OldPos.p)
  306. L.CFrame = L.CFrame + L.CFrame.lookVector*((NewPos.p - OldPos.p).magnitude/2)
  307. M.VertexColor = Vector3.new(R,G,B)
  308.  
  309. OldPos = NewPos
  310.  
  311. if v[1]%360 == 0 and v[2]%360 == 0 and v[3]%360 == 0 and not StopTry then
  312. ReachMax = true
  313. elseif v[1]%360 ~= 0 or v[2]%360 ~= 0 or v[3]%360 ~= 0 then
  314. ReachMax = false
  315. StopTry = true
  316. end
  317. end
  318. wait()
  319. co=co+1
  320. until ReachMax
  321.  
  322. for i,v in pairs(Parts) do
  323. v:Destroy()
  324. end
  325. end
  326.  
  327. for i=1,7 do
  328. local Label = TextLabel(WS,UDim2.new(.1,0,.075,0),UDim2.new(.05,0,.05+(i-1)*0.085,0),WantedColor)
  329. Label.Text = "S"..i
  330. local X = TextBox(Label,UDim2.new(1,0,1,0),UDim2.new(1),WantedColor); X.BorderSizePixel = 0
  331. X.Changed:connect(function()
  332. Angles[i][1] = tonumber(X.Text)
  333. end)
  334. local Y = TextBox(Label,UDim2.new(1,0,1,0),UDim2.new(2.02),WantedColor); Y.BorderSizePixel = 0
  335. Y.Changed:connect(function()
  336. Angles[i][2] = tonumber(Y.Text)
  337. end)
  338. local Z = TextBox(Label,UDim2.new(1,0,1,0),UDim2.new(3.05),WantedColor); Z.BorderSizePixel = 0
  339. Z.Changed:connect(function()
  340. Angles[i][3] = tonumber(Z.Text)
  341. end)
  342. X.Text = Angles[i][1]; Y.Text = Angles[i][2]; Z.Text = Angles[i][3]
  343. if i > TStick then Label.Visible = false end
  344. table.insert(MStick,i,Label)
  345. end
  346.  
  347. local IncStick = TextButton(WS,UDim2.new(.055,0,.05,0),UDim2.new(.9,0,.05,0),WantedColor)
  348. IncStick.Text = "^"
  349. local DecStick = TextButton(WS,UDim2.new(.055,0,.049,0),UDim2.new(.9,0,.1,0),WantedColor)
  350. DecStick.Text = "v"
  351. local ShoStick = TextBox(WS,UDim2.new(.3,0,.1,0),UDim2.new(.6,0,.05,0),WantedColor)
  352. ShoStick.Text = TStick
  353.  
  354. IncStick.MouseButton1Click:connect(function()
  355. if TStick == 7 then return end
  356. TStick = TStick + 1
  357. ShoStick.Text = TStick
  358. reVisible(TStick)
  359. end)
  360. DecStick.MouseButton1Click:connect(function()
  361. if TStick == 1 then return end
  362. TStick = TStick - 1
  363. ShoStick.Text = TStick
  364. reVisible(TStick)
  365. end)
  366. ShoStick.Changed:connect(function()
  367. if tonumber(ShoStick.Text) < 1 then
  368. TStick = 1
  369. reVisible(TStick)
  370. elseif tonumber(ShoStick.Text) > 7 then
  371. TStick = 7
  372. reVisible(TStick)
  373. else
  374. ShoStick.Text = TStick
  375. end
  376. ShoStick.Text = TStick
  377. end)
  378.  
  379. local Generate = TextButton(WS,UDim2.new(0.8,0,0.2,0),UDim2.new(0.1,0,0.7,0),WantedColor); Generate.Text = "Generate"
  380. Generate.MouseButton1Click:connect(function()
  381. CreateGeometry()
  382. end)
  383.  
  384. --[[
  385. https://www.dropbox.com/s/a04p072vb868ejj/Geometrical%20GUI.lua?dl=1
  386. ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement