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

Why is this variable not being detected?

Asked by 8 years ago
[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.

0
Could you put this into the correct format please? It'd be alot easier for us to help. dyler3 1510 — 8y

1 answer

Log in to vote
0
Answered by
Hexcede 52
8 years ago

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.

Ad

Answer this question