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 team-only seats like owner-only doors in tycoons?

I've tried scripting myself, I've looked for videos online and I couldn't find any way how to make team-only seats. So a certain team gets to only sit on the seat, while the other players on other teams automatically reset when they sit on the other team-only seat similar to owner-only doors in tycoons.

2 comments

0

Not a request site!

0

Here we correct/fix your scripts, we don't give you free codes like Landon giving free robux.

1 answer

✓ Accepted answer

It's not too complicated, what you're looking for is probably Occupant which is a property of seat which returns the humanoid that is occupying the seat, which is kind of self-explanatory.

You can have the seat connected to the .Changed event so when someone sits on it, it will fire and then you can use Occupant and find the player's name like so:

( this is example code and I wrote this up quickly it may not work)

local seat = script.Parent

seat.Changed:Connect(function()
	local occupant = seat.Occupant
	local occupantName = occupant.Parent.Name
	local player = game:GetService('Players'):FindFirstChild(occupantName)
	if player then
		if player.Team == BrickColor.new('Really red') then
			-- kill the player here
		end
	end
end)


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