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

Why is this variable not being detected?

[40]plr = game.Players:GetPlayerFromCharacter(chr)
[41]local hum = vCharacter:findFirstChild("Humanoid")
[42]if hit.Parent.Name ~= "Soldier" and hit.Parent.Name ~= ("Guest") and hit.Parent.Name ~= ("") and hit.Parent.Name ~= "Emperor" and hit.Parent.Name ~= "Governor" and hit.Parent.Name ~= "Door" and hit.Parent.Name ~= "Door1" and plr.TeamColor ~= BrickColor.new("Bright blue") and humanoid~=nil and humanoid ~= hum and hum ~= nil then

Output: 13:26:03.117 - Players.Player.Backpack.NATMSword.SwordScript:42: attempt to index global 'plr' (a nil value) 13:26:03.118 - Stack Begin 13:26:03.118 - Script 'Players.Player.Backpack.NATMSword.SwordScript', Line 42 13:26:03.119 - Stack End

In the script it clearly has the value "plr" in the script. For some reason the engine isn't able to find the value? I took a piece of code from this giant sword script.

1 comment

0

Could you put this into the correct format please? It'd be alot easier for us to help.

1 answer

✓ Accepted answer

Your problem: the chr value is not a character of the player, or the chr value is nil meaning it is empty or the character no longer exists.

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