local loc = 50 local target = script.Parent.TargetPlayer.Value repeat wait() until(target:FindFirstChild("Torso").Position - target:FindFirstChild("Humanoid"):FindFirstChild("Soldier").Torso.Position).magnitude > loc script.Parent.Stars2.Disabled = false script.Parent.NonActive.Disabled = true script.Parent.Active.Disabled = false script.Disabled = true
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.