of     1   

MightyDantheman
#184286774Thursday, February 25, 2016 4:17 AM GMT

So I finally got an NPC that runs away from the closest player, but there is only one problem. The script seems to break after a while. I was chasing it around with one player towards the other player, and it was working fine. But after a bit, it just stopped. You could say it got scared out of it's mind, but I'd like to fix this. Closest Player Script: wait(1) repeat wait(0.5) until (game.Players.NumPlayers >= 1) while true do local smallest = {math.huge,nil} for _,v in pairs(game.Players:GetPlayers()) do local cur = v:DistanceFromCharacter(script.Parent.Parent.Torso.Position) if cur < smallest[1] then smallest[1] = cur smallest[2] = v end end script.Parent.Value = smallest[2].Name wait() end --// Run Script: local phase = script.Parent.Phase local h = script.Parent.Humanoid local name = script.Parent.Target wait(10) while true do if name.Value ~= "" then local plr = game.Workspace:FindFirstChild(name.Value) if phase.Value == "Run" then tor = script.Parent.Torso tar = plr.Torso local newCF = CFrame.new(tor.Position,tar.Position) local direction = newCF.lookVector * -1 h:Move(direction) end end wait() end --// Errors: 20:18:45.173 - New connection from 127.0.0.1|57615 20:18:45.242 - Replication: Can't create default object of type Players Player -1 added 20:18:46.436 - New connection from 127.0.0.1|65210 20:18:46.448 - Replication: Can't create default object of type Players Player -2 added ~MightyDantheman
MightyDantheman
#184287627Thursday, February 25, 2016 4:36 AM GMT

It's not really that long? Please help me. x.x ~MightyDantheman
MightyDantheman
#184288195Thursday, February 25, 2016 4:49 AM GMT

Anyone? ~MightyDantheman
MightyDantheman
#184308939Thursday, February 25, 2016 7:36 PM GMT

Bump. ~MightyDantheman
darthpyro
#184308992Thursday, February 25, 2016 7:37 PM GMT

Those errors have nothing to do with this script.
TimeTicks
#184309043Thursday, February 25, 2016 7:38 PM GMT

Learn how to debug your code
powerhotmail123
#184309086Thursday, February 25, 2016 7:39 PM GMT

As far as I know, the output you provided are not really related or 'errors'. Anything else? Enjoying your stay at the Scripters Forum? Join this! http://www.roblox.com/My/Groups.aspx?gid=2582784
MightyDantheman
#184309893Thursday, February 25, 2016 7:56 PM GMT

Welp, this is all studio gave me, so this is all I have to work with. I only have one solution to this, I'm thinking I'll have to reset the script somehow. But how would I reset a script? Do I clone it and delete the original? ~MightyDantheman
MightyDantheman
#184314062Thursday, February 25, 2016 9:15 PM GMT

Anyone have any solutions on how I could reset the script or fix this problem? ~MightyDantheman
MightyDantheman
#184318563Thursday, February 25, 2016 10:21 PM GMT

One more bump before I make a new thread about script reseting... x.x ~MightyDantheman

    of     1