MoveTo not working in LocalScript? [SOLVED]

That doesn’t work. Model classes do not have the :MoveTo() function. Secondly as the OP already mentioned, the fox didn’t move on the client.

1 Like

Actually, it does, but not the function make the character move naturally
https://developer.roblox.com/en-us/api-reference/function/Model/MoveTo
If she uses this, 100% it will happen on the client side, but the problem is it’s not moving, its teleporting

3 Likes

I based it on Model:MoveTo

1 Like

Maybe she need to take the problem otherwise ? :thinking:

I think that in any case the character will teleport ? :thinking:

I’m new to tweening so I went on this to help me: Introduction to Tweening Models - Resources / Community Tutorials - DevForum | Roblox

So this is my new script but it isn’t working…

local TweenService = game:GetService("TweenService")

local primaryPart = game.Workspace:WaitForChild("Fox").PrimaryPart

local pointE = game.Workspace:WaitForChild("PointE")

local tweeninfo = TweenInfo.new()

local foxSlideTween = TweenService:Create(primaryPart, tweeninfo, {
	CFrame = pointE.CFrame
})

foxSlideTween:Play()

Tween is pretty uncomfortable on a character, don’t use it too often.
Also I suppose you’re wrong at the goal CFrame, just type CFrame = primaryPart.CFrame

1 Like

Is there any errors in the output?

1 Like

No (I edited the script but it still isn’t working :slightly_frowning_face:)

Bro the tween info is blank, you need to put at least a time value

1 Like

Alright, this is my LocalScript:

local TweenService = game:GetService("TweenService")

local primaryPart = game.Workspace:WaitForChild("Fox").PrimaryPart

local pointE = game.Workspace:WaitForChild("PointE")

local tweeninfo = TweenInfo.new(1)

local foxSlideTween = TweenService:Create(primaryPart, tweeninfo, {
	CFrame = pointE.CFrame
})

foxSlideTween:Play()

nothing happens…

Not even an error shown in the console?
Ok I’m quite confused now, as you said before, I may think of a script like this

-- Note that this is a normal script
local Fox = ... -- ur fox

game.Players.PlayerAdded:Connect(function(plr)
    plr.CharacterAdded:Connect(function(Char)
    local NewFox = Fox:Clone
    NewFox.CFrame ..... -- yours
    NewFox.Humanoid:MoveTo(...)
    end)
end)

That is all I can think of now, I don’t usually use local script on a character so I can’t help much.

1 Like

no errors (3 0 c h a r a c t e r s)

How are all your fox’s body parts connected to your humanoidrootpart?

If even one isnt connected properly your npc wont move anywhere. I would double check all your connections.

1 Like

They’re all connected with Motor6Ds, thanks for replying.

1 Like

Im assuming you’ve done this before with other animals and its just this animal that is giving the issue?

Yeah, this works on a ServerScript but it’s not working on a LocalScript:

local fox = game.Workspace:WaitForChild("Fox")

local humanoid = fox:WaitForChild("Humanoid")

local foxPoint1 = game.Workspace:WaitForChild("PointE")

humanoid:MoveTo(foxPoint1.Position)

humanoid.MoveToFinished:Wait()

I’m not experienced with tweening though.

I explained to you in an earlier reply why that isn’t working in a LocalScript the way it is.

You’d have to create or clone the fox on the client itself, and then use MoveTo on its humanoid (not its root part) in a localscript, using a position/point (not a CFrame) as the first argument. Additionally, MoveTo takes another argument, which is a part that the point becomes relative to.

For example, if you do Fox:FindFirstChild(“Humanoid”):MoveTo(point, part) , then if the part moves, the point will relatively follow it.

Alternatively, if the network owner of the fox is set to the player on the server, then you can move it from a localscript in that player’s client, but in this case all other players will see the fox move, in which case it’d be better and more convenient to move it on the server.

The reason this happens is due to the network ownership of the part.

You’d need to add a couple of things to your code:

local fox = workspace:WaitForChild("Fox")
local foxPoint1 = workspace:WaitForChild("PointE")

local clientFox = fox:Clone()
clientFox.Parent = workspace
fox:Destroy()

local humanoid = clientFox:FindFirstChild("Humanoid")

humanoid:MoveTo(foxPoint1.Position)
humanoid.MoveToFinished:Wait()
3 Likes

Check to see that your humanoid has its rootpart as humanoidrootpart.

And where is your local script located? Try StarterPlayerScripts.

Make sure all parts are unanchored.

1 Like

Thank you so much! Sorry, I didn’t see that earlier. Thank you @RMofSBI aswell & everyone else who was kind enough to help me out!

2 Likes