function ontouch(hit) distance = script.Parent.Dist.Value local player = game.Players:FindFirstChild(hit.Parent.Name) if (hit.Parent.Torso.Position - game.Workspace:FindFirstChild(hit.Parent.Name.. "'s Cop").Torso.Position).magnitude > distance then wait(3) player.PlayerGui.ScreenGui.ImageLabel4.Visible = false player.PlayerGui.ScreenGui.Label4.Visible = true wait(4) player.PlayerGui.ScreenGui.ImageLabel3.Visible = false player.PlayerGui.ScreenGui.Label3.Visible = true wait(3) player.PlayerGui.ScreenGui.ImageLabel2.Visible = false player.PlayerGui.ScreenGui.Label2.Visible = true wait(5) player.PlayerGui.ScreenGui.Label1.Visible = true player.PlayerGui.ScreenGui.ImageLabel1.Visible = false game.Workspace:FindFirstChild(hit.Parent.Name.. "'s Cop"):Destroy() else if (hit.Parent.Torso.Position - game.Workspace:FindFirstChild(hit.Parent.Name.. "'s Cop").Torso.Position).magnitude < distance then player.PlayerGui.ScreenGui.ImageLabel4.Visible = false player.PlayerGui.ScreenGui.ImageLabel3.Visible = false player.PlayerGui.ScreenGui.ImageLabel2.Visible = false player.PlayerGui.ScreenGui.ImageLabel1.Visible = false player.PlayerGui.ScreenGui.Label4.Visible = true player.PlayerGui.ScreenGui.Label3.Visible = true player.PlayerGui.ScreenGui.Label2.Visible = true player.PlayerGui.ScreenGui.Label1.Visible = true end end end script.Parent.Touched:connect(ontouch)
why wont this script work? this script is in a NPC. if the player and NPC's distance is not as it says in the distance then the imagelabel's will not be visible and labels will be visible but if the distance between the NPC and the player is as it says in the distance then the labels will not be visible and imagelabels will be visible. this script wont work why? can i get some help on this