Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

1 answer

✓ Accepted answer

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!

1 comment

0

Thank you so much!

This discussion is preserved as it was. New answers, comments, and votes are closed.