Why would this script when trying to run a tram system I made not work?
UIS = game:GetService("UserInputService")
local Seat = script.Parent -- Path to seat
Seat:GetPropertyChangedSignal("Occupant"):Connect(function()
if Seat.Occupant ~= nil then
local Char = Seat.Occupant.Parent
UIS.InputBegan:Connect(function(input)
if input.KeyCode == Enum.KeyCode.W then
while task.wait() do -- a loop
game.Workspace.TrainKit1.Base.AssemblyLinearVelocity = script.Parent.CFrame.LookVector*-15
end
while task.wait() do -- a loop
game.Workspace.TrainKit2.Base.AssemblyLinearVelocity = script.Parent.CFrame.LookVector*-15
end
end
end)
end
end)