Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why would this script when trying to run a tram system I made not work?

Asked by
pevdn 32
2 years ago
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)

Answer this question