Advertisement
rcubed1003

fe train script

Sep 12th, 2020 (edited)
61
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.62 KB | None | 0 0
  1. -- ty krystalburger
  2. --[[
  3. Thomas The Dank Engine:
  4. By: KrystalTeam
  5. Features: Being a dank engine that kill people
  6. Version: 1.0.0.2
  7. --]]
  8. -- This script has convert to FE by who i don't know?
  9.  
  10. -----------------------------------------------------
  11. if game:GetService("RunService"):IsClient() then error("Script must be server-side in order to work; use h/ and not hl/") end
  12. local Player,game,owner = owner,game
  13. local RealPlayer = Player
  14. do
  15. print("FE Compatibility code by Mokiros | Showcase by Bacon Hair!")
  16. local rp = RealPlayer
  17. script.Parent = rp.Character
  18.  
  19. --RemoteEvent for communicating
  20. local Event = Instance.new("RemoteEvent")
  21. Event.Name = "UserInput_Event"
  22.  
  23. --Fake event to make stuff like Mouse.KeyDown work
  24. local function fakeEvent()
  25. local t = {_fakeEvent=true,Functions={},Connect=function(self,f)table.insert(self.Functions,f) end}
  26. t.connect = t.Connect
  27. return t
  28. end
  29.  
  30. --Creating fake input objects with fake variables
  31. local m = {Target=nil,Hit=CFrame.new(),KeyUp=fakeEvent(),KeyDown=fakeEvent(),Button1Up=fakeEvent(),Button1Down=fakeEvent()}
  32. local UIS = {InputBegan=fakeEvent(),InputEnded=fakeEvent()}
  33. local CAS = {Actions={},BindAction=function(self,name,fun,touch,...)
  34. CAS.Actions[name] = fun and {Name=name,Function=fun,Keys={...}} or nil
  35. end}
  36. --Merged 2 functions into one by checking amount of arguments
  37. CAS.UnbindAction = CAS.BindAction
  38.  
  39. --This function will trigger the events that have been :Connect()'ed
  40. local function te(self,ev,...)
  41. local t = m[ev]
  42. if t and t._fakeEvent then
  43. for _,f in pairs(t.Functions) do
  44. f(...)
  45. end
  46. end
  47. end
  48. m.TrigEvent = te
  49. UIS.TrigEvent = te
  50.  
  51. Event.OnServerEvent:Connect(function(plr,io)
  52. if plr~=rp then return end
  53. m.Target = io.Target
  54. m.Hit = io.Hit
  55. if not io.isMouse then
  56. local b = io.UserInputState == Enum.UserInputState.Begin
  57. if io.UserInputType == Enum.UserInputType.MouseButton1 then
  58. return m:TrigEvent(b and "Button1Down" or "Button1Up")
  59. end
  60. for _,t in pairs(CAS.Actions) do
  61. for _,k in pairs(t.Keys) do
  62. if k==io.KeyCode then
  63. t.Function(t.Name,io.UserInputState,io)
  64. end
  65. end
  66. end
  67. m:TrigEvent(b and "KeyDown" or "KeyUp",io.KeyCode.Name:lower())
  68. UIS:TrigEvent(b and "InputBegan" or "InputEnded",io,false)
  69. end
  70. end)
  71. Event.Parent = NLS([==[
  72. local Player = game:GetService("Players").LocalPlayer
  73. local Event = script:WaitForChild("UserInput_Event")
  74.  
  75. local Mouse = Player:GetMouse()
  76. local UIS = game:GetService("UserInputService")
  77. local input = function(io,a)
  78. if a then return end
  79. --Since InputObject is a client-side instance, we create and pass table instead
  80. Event:FireServer({KeyCode=io.KeyCode,UserInputType=io.UserInputType,UserInputState=io.UserInputState,Hit=Mouse.Hit,Target=Mouse.Target})
  81. end
  82. UIS.InputBegan:Connect(input)
  83. UIS.InputEnded:Connect(input)
  84.  
  85. local h,t
  86. --Give the server mouse data 30 times every second, but only if the values changed
  87. --If player is not moving their mouse, client won't fire events
  88. while wait(1/30) do
  89. if h~=Mouse.Hit or t~=Mouse.Target then
  90. h,t=Mouse.Hit,Mouse.Target
  91. Event:FireServer({isMouse=true,Target=t,Hit=h})
  92. end
  93. end]==],Player.Character)
  94.  
  95. ----Sandboxed game object that allows the usage of client-side methods and services
  96. --Real game object
  97. local _rg = game
  98.  
  99. --Metatable for fake service
  100. local fsmt = {
  101. __index = function(self,k)
  102. local s = rawget(self,"_RealService")
  103. if s then return s[k] end
  104. end,
  105. __newindex = function(self,k,v)
  106. local s = rawget(self,"_RealService")
  107. if s then s[k]=v end
  108. end,
  109. __call = function(self,...)
  110. local s = rawget(self,"_RealService")
  111. if s then return s(...) end
  112. end
  113. }
  114. local function FakeService(t,RealService)
  115. t._RealService = typeof(RealService)=="string" and _rg:GetService(RealService) or RealService
  116. return setmetatable(t,fsmt)
  117. end
  118.  
  119. --Fake game object
  120. local g = {
  121. GetService = function(self,s)
  122. return self[s]
  123. end,
  124. Players = FakeService({
  125. LocalPlayer = FakeService({GetMouse=function(self)return m end},Player)
  126. },"Players"),
  127. UserInputService = FakeService(UIS,"UserInputService"),
  128. ContextActionService = FakeService(CAS,"ContextActionService"),
  129. }
  130. rawset(g.Players,"localPlayer",g.Players.LocalPlayer)
  131. g.service = g.GetService
  132.  
  133. g.RunService = FakeService({
  134. RenderStepped = _rg:GetService("RunService").Heartbeat,
  135. BindToRenderStep = function(self,name,_,fun)
  136.  
  137. end,
  138. UnbindFromRenderStep = function(self,name)
  139. self._btrs[name]:Disconnect()
  140. end,
  141. },"RunService")
  142.  
  143. setmetatable(g,{
  144. __index=function(self,s)
  145. return _rg:GetService(s) or typeof(_rg[s])=="function"
  146. and function(_,...)return _rg[s](_rg,...)end or _rg[s]
  147. end,
  148. __newindex = fsmt.__newindex,
  149. __call = fsmt.__call
  150. })
  151. --Changing owner to fake player object to support owner:GetMouse()
  152. game,owner = g,g.Players.LocalPlayer
  153. end
  154. m = game.Players.LocalPlayer
  155. char = m.Character
  156.  
  157. function Random(num)
  158. local section=num % 1 * 3;
  159. local secondary=0.5 * math.pi * (section % 1);
  160. if section < 1 then
  161. return 1,1 - math.cos(secondary),1 - math.sin(secondary);
  162. elseif section < 2 then
  163. return 1 - math.sin(secondary),1,1 - math.cos(secondary);
  164. else
  165. return 1 - math.cos(secondary),1 - math.sin(secondary),1;
  166. end
  167. end
  168.  
  169. --//Lol try to figure this one out//
  170. function rainb(hue)
  171. local section = hue % 1 * 3
  172. local secondary = 0.5 * math.pi * (section % 1)
  173. if section < 1 then
  174. return Color3.new(1, 1 - math.cos(secondary), 1 - math.sin(secondary))
  175. elseif section < 2 then
  176. return Color3.new(1 - math.sin(secondary), 1, 1 - math.cos(secondary))
  177. else
  178. return Color3.new(1 - math.cos(secondary), 1 - math.sin(secondary), 1)
  179. end
  180. end
  181.  
  182. local p = game.Players.LocalPlayer.Character
  183. local weld = Instance.new("Weld",p.Torso)
  184. weld.Part0 = p.Torso
  185.  
  186. local train = Instance.new("Part",p.Torso)
  187. train.Anchored = true
  188. train.CanCollide = false
  189. train.Size = Vector3.new(3,2,6)
  190. train.CustomPhysicalProperties = PhysicalProperties.new(0,0,0,0,0)
  191. weld.Part1 = train
  192. weld.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(180),0)
  193. train.Anchored = false
  194. local TrainMesh = Instance.new("SpecialMesh",train)
  195. TrainMesh.MeshType = Enum.MeshType.FileMesh
  196. TrainMesh.Scale = Vector3.new(0.020,0.020,0.015)
  197. TrainMesh.MeshId = "rbxassetid://431017802"
  198. TrainMesh.TextureId = "rbxassetid://431017809"
  199.  
  200.  
  201. local weld2 = Instance.new("Weld",p.Torso)
  202. weld2.Part0 = p.Torso
  203. local Smoke = Instance.new("Part",p.Torso)
  204. Smoke.Anchored = true
  205. Smoke.CanCollide = false
  206. Smoke.Size = Vector3.new(1,1,1)
  207. Smoke.CustomPhysicalProperties = PhysicalProperties.new(0,0,0,0,0)
  208. weld2.Part1 = Smoke
  209. weld2.C1 = CFrame.new(0,-4,3.5)-- * CFrame.Angles(0,math.rad(180),0)
  210. Smoke.Anchored = false
  211. Smoke.Transparency = 1;
  212.  
  213. local Particle = Instance.new("ParticleEmitter",Smoke)
  214. Particle.Rate = 50;
  215. Particle.Speed = NumberRange.new(30,60);
  216. Particle.VelocitySpread = 4;
  217. Particle.Texture = "rbxassetid://133619974"
  218.  
  219. local Light = Instance.new("SpotLight",train)
  220. Light.Angle = 45;
  221. Light.Brightness = 100;
  222. Light.Face = Enum.NormalId.Back;
  223. Light.Range = 30;
  224.  
  225. p.Humanoid.WalkSpeed = 20;
  226.  
  227.  
  228. for i,v in pairs(p:GetChildren()) do
  229. if v:IsA("Part") then
  230. v.Transparency = 1;
  231. elseif v:IsA("Hat") then
  232. v:Destroy()
  233. elseif v:IsA("Model") then
  234. v:Destroy()
  235. end
  236. end
  237.  
  238. local function SFX(id) local s=Instance.new("Sound",p.Torso); s.SoundId = "rbxassetid://"..id; s.Volume = 1; return s; end
  239. train.Touched:connect(function(p)
  240. if p.Parent then
  241. if p.Parent:IsA("Model") then
  242. if game.Players:FindFirstChild(p.Parent.Name) then
  243. if p.Parent.Name ~= game.Players.LocalPlayer.Name then
  244. game.Players:FindFirstChild(p.Parent.Name).Character:BreakJoints()
  245. local Whistle = SFX(604650009)
  246. Whistle:Play()
  247. end
  248. end
  249. end
  250. end
  251. end)
  252.  
  253. local Music = SFX(190819252)
  254. Music.Looped = true;
  255. wait(1)
  256. Music:Play();
  257. -- ~CL 2016
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement