I have a very simple script for an r6 rig in a tower defense game. It is supposed to move towards a total of 3 different points, however, when moving towards the second one, just a couple of studs away from the target position, it turns toward the last point and falls, btu it has not yet rea ched the target position, so I dont know what is going on.
1 | local humanoid = script.Parent.Humanoid |
2 |
3 | humanoid:MoveTo(workspace.TurnPoints.Start.Position) |
4 | humanoid.MoveToFinished:Wait() |
5 | humanoid:MoveTo(workspace.TurnPoints:FindFirstChild( "1" ).Position) |
6 | humanoid.MoveToFinished:Wait() |
7 | humanoid:MoveTo(workspace.TurnPoints:FindFirstChild( "2" ).Position) |
8 | humanoid.MoveToFinished:Wait() |
Well, there can be several things that can be creating the issue. Here, I am assuming that the problem is related to NetworkOwnerShip
. I think that the R6 is falling because of continuous change of network owner from the player to the server. To fix that :
1 | -- Add this at the end line |
2 |
3 | script.Parent.PrimaryPart:SetNetworkOwner( nil ) -- nil = Server |
If the above doesn't work, then : For debugging purposes, test the game by using 'Run' and not 'Play' and check whether the R6 is able to complete.
Lemme know if it helps!
MoveTo is not a thing . . . and you cant move a humanoid . . . you need to get the character HumanoidRootPart and then change it position
1 | local player = game.Players.LocalPlayer |
2 |
3 | player.Character.HumanoidRootPart.Position = vector 3. new( 0 , 0 , 0 ) --put your position here |