DrawingJhon

Thomas the Train FE

Aug 18th, 2020 (edited)
352
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 3.16 KB | None | 0 0
  1. ------------------------------------
  2. -- Thomas the Train --
  3. -- Compatibility by me ---
  4. ------------------------------------
  5. local filter = false
  6. if game.PlaceId == 843468296 then
  7.     filter = true
  8. elseif game.PlaceId == 843495510 and owner then
  9.     filter = true
  10. end
  11.  
  12. local owner = owner or game:GetService("Players").LocalPlayer or game:GetService("Players"):GetPlayerFromCharacter(script.Parent) or error("Not player found in script")
  13. local p = owner.Character
  14. script.Parent = p
  15. local weld = Instance.new("Weld",p.Torso)
  16. weld.Part0 = p.Torso
  17. local train = Instance.new("Part",p.Torso)
  18. train.Anchored = true
  19. train.CanCollide = false
  20. train.Size = Vector3.new(3,2,6)
  21. train.CustomPhysicalProperties = PhysicalProperties.new(0,0,0,0,0)
  22. weld.Part1 = train
  23. weld.C1 = CFrame.new(0,0,0) * CFrame.Angles(0,math.rad(180),0)
  24. train.Anchored = false
  25. local TrainMesh = Instance.new("SpecialMesh",train)
  26. TrainMesh.MeshType = Enum.MeshType.FileMesh
  27. TrainMesh.Scale = Vector3.new(0.020,0.020,0.015)
  28. TrainMesh.MeshId = "rbxassetid://431017802"
  29. TrainMesh.TextureId = "rbxassetid://431017809"
  30. local weld2 = Instance.new("Weld",p.Torso)
  31. weld2.Part0 = p.Torso
  32. local Smoke = Instance.new("Part",p.Torso)
  33. Smoke.Anchored = true
  34. Smoke.CanCollide = false
  35. Smoke.Size = Vector3.new(1,1,1)
  36. Smoke.CustomPhysicalProperties = PhysicalProperties.new(0,0,0,0,0)
  37. weld2.Part1 = Smoke
  38. weld2.C1 = CFrame.new(0,-4,3.5)-- * CFrame.Angles(0,math.rad(180),0)
  39. Smoke.Anchored = false
  40. Smoke.Transparency = 1;
  41. local Particle = Instance.new("ParticleEmitter",Smoke)
  42. Particle.Rate = 50;
  43. Particle.Speed = NumberRange.new(30,60);
  44. Particle.VelocitySpread = 4;
  45. Particle.Texture = "rbxassetid://133619974"
  46. local Light = Instance.new("SpotLight",train)
  47. Light.Angle = 45;
  48. Light.Brightness = 100;
  49. Light.Face = Enum.NormalId.Back;
  50. Light.Range = 30;
  51. p.Humanoid.WalkSpeed = 60;
  52. for i,v in pairs(p:GetChildren()) do
  53.     if v:IsA("Part") then
  54.         v.Transparency = 1;
  55.     elseif v:IsA("Hat") then
  56.         v:Destroy()
  57.     elseif v:IsA("Model") then
  58.         v:Destroy()
  59.     end
  60. end
  61. local folder
  62. if filter then
  63.     folder = Instance.new("Folder", p.Torso)
  64.     folder.Name = "Cuacks"
  65.     for i = 1,25 do
  66.         local s = Instance.new("Sound", folder)
  67.         s.SoundId = "rbxassetid://475073913"
  68.         s.Volume = 1
  69.     end
  70. end
  71. local function SFX(id) local s=Instance.new("Sound",p.Torso); s.SoundId = "rbxassetid://"..id; s.Volume = 1; return s; end
  72. train.Touched:connect(function(hit)
  73.     if hit.Parent then
  74.         if hit.Parent:IsA("Model") and hit.Parent:findFirstChildOfClass("Humanoid") then
  75.             local ple = game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
  76.             if ple then
  77.                 if ple == owner then return end
  78.             end
  79.             hit.Parent:BreakJoints()
  80.             if not filter then
  81.                 local Whistle = SFX(475073913)
  82.                 Whistle:Play()
  83.                 return
  84.             end
  85.             local sound
  86.             local tm = 0
  87.             for i, v in pairs(folder:GetChildren()) do
  88.                 if v:IsA("Sound") then
  89.                     if not v.IsPlaying then
  90.                         sound = v
  91.                         break
  92.                     elseif v.TimePosition >= tm then
  93.                         sound = v
  94.                         tm = v.TimePosition
  95.                     end
  96.                 end
  97.             end
  98.             if sound then
  99.                 sound:Play()
  100.             end
  101.         end
  102.     end
  103. end)
  104. local Music = SFX(250633339)
  105. Music.Looped = true;
  106. Music.Volume = 10
  107. wait(1)
  108. Music:Play();
Add Comment
Please, Sign In to add comment