Advertisement
Guest User

Untitled

a guest
Mar 4th, 2018
628
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.33 KB | None | 0 0
  1. local rotated = false
  2. spawn(function()
  3.     while wait(0.00000000001) do
  4.         for i,x in pairs(script.Parent:GetChildren()) do
  5.             if x.Name == "Seat" then
  6.                 if x:FindFirstChild("SeatWeld") then
  7.                     local humanoid = x.Occupant
  8.                     humanoid.Parent:SetPrimaryPartCFrame(x.CFrame+Vector3.new(0,2,0))
  9.                 end
  10.             end
  11.         end
  12.     end
  13. end)
  14.  
  15. while wait(0.5) do
  16.     local part = script.Parent.Main
  17.     local ray = Ray.new(part.CFrame.p, CFrame.new(0,part.CFrame.Y-500,0).p)
  18.  
  19.     local hitpart, position = workspace:FindPartOnRay(ray, script.Parent.Parent)
  20.     if hitpart then
  21.         local tweenService = game:GetService("TweenService")
  22.         local CFrameValue = Instance.new("CFrameValue")
  23.         local info = TweenInfo.new(0.5)
  24.         CFrameValue.Value = script.Parent:GetPrimaryPartCFrame()
  25.    
  26.         CFrameValue:GetPropertyChangedSignal("Value"):connect(function()
  27.             script.Parent:SetPrimaryPartCFrame(CFrameValue.Value)
  28.         end)
  29.         local cframe = CFrame.new(position.x,position.y+4,position.z)
  30.         if rotated == true then
  31.             cframe = cframe * CFrame.Angles(0,0,150.5)
  32.             rotated = false
  33.         else
  34.             cframe = cframe * CFrame.Angles(0,0,145)
  35.             rotated = true
  36.         end
  37.         local tween = tweenService:Create(CFrameValue, info, {Value = cframe})
  38.         tween:Play()
  39.        
  40.         local able = false
  41.    
  42.         tween.Completed:connect(function()
  43.             CFrameValue:Destroy()
  44.             able = true
  45.         end)
  46.     end
  47. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement