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

How to get a player in a team when they touched a touch to claim door?

1 answer

✓ Accepted answer
local part = script.Parent -- variable for part
local claimed = false -- sets a boolean to check if the door is claimed or not

part.Touched:connect(function(hit) -- when the part is touched, hit is defined as the thing that touched the part
	if game.Players:FindFirstChild(hit.Parent.Name) and claimed == false then -- checks hit is a player
		claimed = true -- the door is now claimed
		local player = game.Players:FindFirstChild(hit.Parent.Name) -- defines the player variable
		player.Neutral = false -- now the player is in a team
		player.Team = game.Teams.blue -- change blue to whatever team you want it to be (the team has to be already created)
	end
end)

should work -- tested it

1 comment

0

It work but now the problam is that the touch to claim door won't dissapear

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