Why Wont This Script Work?
2 | local target = script.Parent.TargetPlayer.Value |
4 | until (target:FindFirstChild( "Torso" ).Position - target:FindFirstChild( "Humanoid" ):FindFirstChild( "Soldier" ).Torso.Position).magnitude > loc |
5 | script.Parent.Stars 2. Disabled = false |
6 | script.Parent.NonActive.Disabled = true |
7 | script.Parent.Active.Disabled = false |
this script goes into a NPC. so basically i want the stars2 script and the Active script to be enabled when the NPC is 50 studs away from a player. this script will not work for some reason.
in the output the error is
13:31:54.557 - Workspace.Player1.Humanoid.Player1's Cop.Stars:4: attempt to index a nil value
13:31:54.558 - Stack Begin
13:31:54.558 - Script 'Workspace.Player1.Humanoid.Player1's Cop.Stars', Line 4
13:31:54.559 - Stack End
the value i used is object value
i have checked the value it has the players name in there.