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

How do I make a "Team only vehicle seat script"?

Asked by 4 years ago
Edited 4 years ago

I've tried looking at other posts but it doesn't seem to work. Can anyone help me, please?

1 answer

Log in to vote
0
Answered by 4 years ago

You need to check as soon as the occupant changed whether or not the given player is of a certain team. If he is not you can force jump him to get him out of the seat.

Example:

local seat = script.Parent -- Change this as needed

seat:GetPropertyChangedSignal("Occupant"):Connect(function()
    local occupant = seat.Occupant

    if occupant then
        local player = game.Players:GetPlayerFromCharacter(occupant.Parent)
        if player.Team ~= game.Teams.YourTeam then -- Change YourTeam
            occupant.Jump = true
        end
    end
end)
Ad

Answer this question