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

Multiple Seat Condition Help?

Asked by
sammiya1 134
7 years ago
local seat_part = game.Workspace.Seat --get the seat

function onTouched(hit)
    if hit.Parent:FindFirstChild("Humanoid") then --check if the part is part of the humanoid's body
        local character = hit.Parent --character (player model on the workspace)
        local humanoid = character:WaitForChild("Humanoid") --humanoid found inside the player's character
        humanoid:MoveTo(seat_part.Position) --function of the humanoid
    end
end

script.Parent.Touched:connect(onTouched)

The thing is i have 4 seats and want that the player walks to the first one only if no one is on it. then walks to the second one if someone is on it. Basically the player walks to any available seat if there is none then the script doesn't move them to a seat. Anyone able to help with that?

Answer this question