Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Is it broken?

Asked by 9 years ago

I can't get this to work.


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

Anybody know how?

0
Line 2, LocalPLayer. Line 2, Remove is Deprecated. Line 1, attempt to call function isOnTeam a nil value. M39a9am3R 3210 — 9y

2 answers

Log in to vote
0
Answered by 9 years ago

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

Ad
Log in to vote
0
Answered by 9 years ago

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.

Answer this question