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

Why is this not working?

Asked by
Benqazx 108
9 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
01local Self=script.Parent;
02local Humanoid=Self:WaitForChild("Humanoid");
03local Torso=Self:WaitForChild("Torso");
04local Pathfinding=game:GetService("PathfindingService");
05local findplayer = script.Parent.playername.Value
06local Player = game.Players:WaitForChild(findplayer)
07 
08local MinimumDistance = 500
09 
10function FetchCoordinate()
11    local Target={
12        Position=Torso.Position;
13        Distance=MinimumDistance;
14    }
15        local pCharacter=Player.Character;
View all 28 lines...

this is a pathfind script. this will follow the player whos name is in findplayer. this script will not work the error in the output is. 00:13:40.929 - Workspace.Player.Humanoid.Player's Cop.Main Script:15: attempt to index upvalue 'Player' (a nil value) 00:13:40.930 - Stack Begin 00:13:40.930 - Script 'Workspace.Player.Humanoid.Player's Cop.Main Script', Line 15 - global FetchCoordinate 00:13:40.930 - Script 'Workspace.Player.Humanoid.Player's Cop.Main Script', Line 26 00:13:40.931 - Stack End

1 answer

Log in to vote
2
Answered by 9 years ago
01local Self = script.Parent;
02local Humanoid = Self:WaitForChild("Humanoid");
03local Torso=Self:WaitForChild("Torso");
04local Pathfinding = game:GetService("PathfindingService");
05local findplayer = script.Parent.playername.Value
06local Player = game.Players:WaitForChild(findplayer)
07 
08local MinimumDistance = 500
09 
10function FetchCoordinate()
11    local Target={
12        Position = Torso.Position;
13        Distance = MinimumDistance;
14    }
15        local pCharacter = Player.Character;
View all 28 lines...

Should work now!

0
can you put that in the lua script thing please because its hard to understand it like this Benqazx 108 — 9y
0
ty for the help it works now Benqazx 108 — 9y
0
Np TheUniPiggy 77 — 9y
Ad

Answer this question