Advertisement
jayrock3401

Untitled

Dec 24th, 2018
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.96 KB | None | 0 0
  1. -- This script has been converted to FE by iPxter
  2.  
  3.  
  4. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  5. local Player,Mouse,mouse,UserInputService,ContextActionService = owner
  6. do
  7. print("FE Compatibility code by Mokiros | Translated to FE by iPxter")
  8. script.Parent = Player.Character
  9.  
  10. --RemoteEvent for communicating
  11. local Event = Instance.new("RemoteEvent")
  12. Event.Name = "UserInput_Event"
  13.  
  14. --Fake event to make stuff like Mouse.KeyDown work
  15. local function fakeEvent()
  16. local t = {_fakeEvent=true,Connect=function(self,f)self.Function=f end}
  17. t.connect = t.Connect
  18. return t
  19. end
  20.  
  21. --Creating fake input objects with fake variables
  22. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  23. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  24. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  25. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  26. end}
  27. --Merged 2 functions into one by checking amount of arguments
  28. CAS.UnbindAction = CAS.BindAction
  29.  
  30. --This function will trigger the events that have been :Connect()'ed
  31. local function te(self,ev,...)
  32. local t = m[ev]
  33. if t and t._fakeEvent and t.Function then
  34. t.Function(...)
  35. end
  36. end
  37. m.TrigEvent = te
  38. UIS.TrigEvent = te
  39.  
  40. Event.OnServerEvent:Connect(function(plr,io)
  41. if plr~=Player then return end
  42. if io.isMouse then
  43. m.Target = io.Target
  44. m.Hit = io.Hit
  45. else
  46. local b = io.UserInputState == Enum.UserInputState.Begin
  47. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  48. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  49. end
  50. for _,t in pairs(CAS.Actions) do
  51. for _,k in pairs(t.Keys) do
  52. if k==io.KeyCode then
  53. t.Function(t.Name,io.UserInputState,io)
  54. end
  55. end
  56. end
  57. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  58. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  59. end
  60. end)
  61. Event.Parent = NLS([==[
  62. local Player = game:GetService("Players").LocalPlayer
  63. local Event = script:WaitForChild("UserInput_Event")
  64.  
  65. local UIS = game:GetService("UserInputService")
  66. local input = function(io,a)
  67. if a then return end
  68. --Since InputObject is a client-side instance, we create and pass table instead
  69. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState})
  70. end
  71. UIS.InputBegan:Connect(input)
  72. UIS.InputEnded:Connect(input)
  73.  
  74. local Mouse = Player:GetMouse()
  75. local h,t
  76. --Give the server mouse data 30 times every second, but only if the values changed
  77. --If player is not moving their mouse, client won't fire events
  78. while wait(1/30) do
  79. if h~=Mouse.Hit or t~=Mouse.Target then
  80. h,t=Mouse.Hit,Mouse.Target
  81. Event:FireServer({isMouse=true,Target=t,Hit=h})
  82. end
  83. end]==],Player.Character)
  84. Mouse,mouse,UserInputService,ContextActionService = m,m,UIS,CAS
  85. end
  86.  
  87.  
  88. Surfaces = {
  89. "FrontSurface",
  90. "BackSurface",
  91. "TopSurface",
  92. "BottomSurface",
  93. "LeftSurface",
  94. "RightSurface"
  95. }
  96. function Part(Parent, Anchor, Collide, Tran, Ref, Color, X, Y, Z, Break)
  97. local p = Instance.new("Part")
  98. p.formFactor = "Custom"
  99. p.Anchored = Anchor
  100. p.CanCollide = Collide
  101. p.Transparency = Tran
  102. p.Reflectance = Ref
  103. p.BrickColor = BrickColor.new(Color)
  104. for _, Surf in pairs(Surfaces) do
  105. p[Surf] = "Smooth"
  106. end
  107. p.Size = Vector3.new(X, Y, Z)
  108. if Break then
  109. p:BreakJoints()
  110. else
  111. p:MakeJoints()
  112. end
  113. p.Parent = Parent
  114. return p
  115. end
  116. function Weld(p0, p1, x, y, z, a, b, c)
  117. local w = Instance.new("Weld")
  118. w.Parent = p0
  119. w.Part0 = p0
  120. w.Part1 = p1
  121. w.C0 = CFrame.new(x, y, z) * CFrame.Angles(a, b, c)
  122. return w
  123. end
  124. function getcf(pos1, pos2)
  125. local pos3 = Vector3.new(pos2.X, pos1.Y, pos2.Z)
  126. return CFrame.new(pos1, pos3)
  127. end
  128. function findjelly(pos)
  129. local t
  130. local d = math.huge
  131. local h, tors
  132. for i, v in pairs(workspace:children()) do
  133. t, h = v:findFirstChild("Torso"), v:findFirstChild("Humanoid")
  134. if t ~= nil and h ~= nil and d > (t.Position - pos).magnitude and h.Health > 0 then
  135. d = (t.Position - pos).magnitude
  136. tors = t
  137. end
  138. end
  139. return tors
  140. end
  141. function maketroll(pos)
  142. local model = Instance.new("Model")
  143. model.Name = "TROLLLLLLZ"
  144. local body = Part(model, false, true, 0, 0, "Really black", 1.3, 4.5, 1.3, true)
  145. local bg = Instance.new("BodyGyro", body)
  146. bg.P = 6000
  147. bg.maxTorque = Vector3.new(math.huge, math.huge, math.huge)
  148. local bv = Instance.new("BodyVelocity", body)
  149. bv.P = 6000
  150. bv.maxForce = Vector3.new(math.huge, math.huge, math.huge)
  151. bv.velocity = Vector3.new(0, 0, 0)
  152. Instance.new("CylinderMesh", body)
  153. local head = Part(model, false, true, 1, 0, "Really black", 3.5, 3.2, 0.4, true)
  154. local neck = Weld(body, head, 0, 3.6, 0, 0, 0, 0)
  155. local fr = Instance.new("Decal", head)
  156. fr.Face = "Front"
  157. fr.Texture = "http://www.roblox.com/asset/?id=29658197"
  158. local ba = Instance.new("Decal", head)
  159. ba.Face = "Back"
  160. ba.Texture = "http://www.roblox.com/asset/?id=29658197"
  161. local Ramodel = Instance.new("Model", model)
  162. local rarm = Part(Ramodel, false, true, 0, 0, "Really black", 0.9, 0.7, 0.9, true)
  163. Instance.new("CylinderMesh", rarm)
  164. local rb = Part(model, false, true, 1, 0, "Really black", 0.1, 0.1, 0.1, true)
  165. local rah = Weld(body, rb, 1, 1.8, 0, 0, 0, 0)
  166. local rw = Weld(rb, rarm, 0, 0, 0, 0, 0, math.pi / 2.8)
  167. for i = 0, -70, -10 do
  168. local rarm2 = Part(Ramodel, false, true, 0, 0, "Really black", 0.9, 0.7, 0.9, true)
  169. Instance.new("CylinderMesh", rarm2)
  170. local w = Weld(rarm, rarm2, -3, 0, 0, 0, 0, math.rad(i))
  171. w.C1 = CFrame.new(-3, 0, 0)
  172. end
  173. local Lamodel = Instance.new("Model", model)
  174. local larm = Part(Lamodel, false, true, 0, 0, "Really black", 0.9, 0.7, 0.9, true)
  175. Instance.new("CylinderMesh", larm)
  176. local lb = Part(model, false, true, 1, 0, "Really black", 0.1, 0.1, 0.1, true)
  177. local lah = Weld(body, lb, -1, 1.8, 0, 0, 0, 0)
  178. local lw = Weld(lb, larm, 0, 0, 0, 0, math.pi, math.pi / 2.8)
  179. for i = 0, -70, -10 do
  180. local larm2 = Part(Lamodel, false, true, 0, 0, "Really black", 0.9, 0.7, 0.9, true)
  181. Instance.new("CylinderMesh", larm2)
  182. local w = Weld(larm, larm2, -3, 0, 0, 0, 0, math.rad(i))
  183. w.C1 = CFrame.new(-3, 0, 0)
  184. end
  185. local Rlmodel = Instance.new("Model", model)
  186. local rleg = Part(Rlmodel, false, true, 0, 0, "Really black", 0.9, 0.7, 0.9, true)
  187. Instance.new("CylinderMesh", rleg)
  188. local rlb = Part(model, false, true, 1, 0, "Really black", 0.1, 0.1, 0.1, true)
  189. local rlh = Weld(body, rlb, 0, -1.9, 0, 0, 0, 0)
  190. local rlw = Weld(rlb, rleg, 0, 0, 0, 0, 0, math.pi / 2.8)
  191. for i = 0, -70, -10 do
  192. local rleg2 = Part(Rlmodel, false, true, 0, 0, "Really black", 0.9, 0.7, 0.9, true)
  193. Instance.new("CylinderMesh", rleg2)
  194. local w = Weld(rleg, rleg2, -3, 0, 0, 0, 0, math.rad(i))
  195. w.C1 = CFrame.new(-3, 0, 0)
  196. end
  197. local Llmodel = Instance.new("Model", model)
  198. local lleg = Part(Llmodel, false, true, 0, 0, "Really black", 0.9, 0.7, 0.9, true)
  199. Instance.new("CylinderMesh", lleg)
  200. local llb = Part(model, false, true, 1, 0, "Really black", 0.1, 0.1, 0.1, true)
  201. local llh = Weld(body, llb, 0, -1.9, 0, 0, 0, 0)
  202. local llw = Weld(llb, lleg, 0, 0, 0, 0, math.pi, math.pi / 2.8)
  203. for i = 0, -70, -10 do
  204. local lleg2 = Part(Llmodel, false, true, 0, 0, "Really black", 0.9, 0.7, 0.9, true)
  205. Instance.new("CylinderMesh", lleg2)
  206. local w = Weld(lleg, lleg2, -3, 0, 0, 0, 0, math.rad(i))
  207. w.C1 = CFrame.new(-3, 0, 0)
  208. end
  209. model.Parent = workspace
  210. model:MakeJoints()
  211. model:MoveTo(pos)
  212. coroutine.resume(coroutine.create(function()
  213. while true do
  214. wait()
  215. if body.Velocity.magnitude > 2 then
  216. coroutine.resume(coroutine.create(function()
  217. for i = 0, 40, 5 do
  218. rw.C1 = CFrame.Angles(math.rad(i), 0, 0)
  219. lw.C1 = CFrame.Angles(math.rad(i), 0, 0)
  220. llw.C1 = CFrame.Angles(math.rad(-i), 0, 0)
  221. rlw.C1 = CFrame.Angles(math.rad(-i), 0, 0)
  222. wait()
  223. end
  224. for i = 40, -40, -5 do
  225. rw.C1 = CFrame.Angles(math.rad(i), 0, 0)
  226. lw.C1 = CFrame.Angles(math.rad(i), 0, 0)
  227. llw.C1 = CFrame.Angles(math.rad(-i), 0, 0)
  228. rlw.C1 = CFrame.Angles(math.rad(-i), 0, 0)
  229. wait()
  230. end
  231. for i = -40, 0, 5 do
  232. rw.C1 = CFrame.Angles(math.rad(i), 0, 0)
  233. lw.C1 = CFrame.Angles(math.rad(i), 0, 0)
  234. llw.C1 = CFrame.Angles(math.rad(-i), 0, 0)
  235. rlw.C1 = CFrame.Angles(math.rad(-i), 0, 0)
  236. wait()
  237. end
  238. end))
  239. end
  240. local jelly = findjelly(body.Position)
  241. if jelly ~= nil then
  242. bg.cframe = getcf(body.Position, jelly.Position)
  243. bv.velocity = bg.cframe.lookVector * 25
  244. else
  245. bv.velocity = Vector3.new(0, 0, 0)
  246. end
  247. end
  248. end))
  249. end
  250. maketroll(Vector3.new(0, 5, 0))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement