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"? [closed]

Asked by 6 years ago

****I would like to know how to make a police car that allows only that team (in this case, police) to drive it. Thanks.****

Closed as Not Constructive by PyccknnXakep, Void_Frost, and Goulstem

This question has been closed because it is not constructive to others or the asker. Most commonly, questions that are requests with no attempt from the asker to solve their problem will fall into this category.

Why was this question closed?

1 answer

Log in to vote
0
Answered by 6 years ago

Put this in the vehicle seat

script.Parent.Touched:connect(function(hit) -- Fires when seat is touched
    local player = game.Players:GetPlayerFromCharacter(hit.Parent) -- locates the player
    local cops = game.Teams:WaitForChild("Cops") -- change "Cops" to the team name
    if hit.Parent:FindFirstChild("Humanoid") and player.Team ~= cops then -- checks if player isn't in team
    wait(0.05) 
    hit.Parent.Humanoid.Sit= false -- kicks player off of seat
    end
end)

This should work because I tested it! Accept my answer if it does!

0
Thank you so much! bromawsomusryanadam -1 — 6y
Ad