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

Is it broken?

I can't get this to work.


if isOnTeam(game.Players.LocalPlayer, "Navy blue") then
	game.Players.LocalPLayer:Remove()
end

Anybody know how?

1 comment

0

Line 2, LocalPLayer. Line 2, Remove is Deprecated. Line 1, attempt to call function isOnTeam a nil value.

2 answers

✓ Accepted answer

Team Colours are BrickColors. Use BrickColor.new('Navy blue')

I would advise doing something like this

if game.Players.LocalPlayer.TeamColor == BrickColor.new("Navy blue") then
	game.Players.LocalPlayer.Character:Destroy()
end

Alternatively,

if game.Players.LocalPlayer.TeamColor == BrickColor.new("Navy blue") then
	game.Players.LocalPlayer.Character.Humanoid.Health = 0
end

(This version will kill the player instead of making them disappear, if I'm correct)

There is no reason that I know of to use a function to compare two values. Make sure this is running on a localscript, as only localscripts can see the localplayer for obvious reasons. As it needs to modify an object in the workspace and be a localscript, FilteringEnabled needs to be off. The player (Under game.Players) and the player's character (Under workspace and is the player's actual body) are two different things. If you want to kill the player, destroy or damage the character. Also, the L in Player on line 2 is capitalized.

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