Help With :MoveTo()

Hello DevFourm, I’m trying to make a simple LocalScript that moves the player when a ClickDetector is clicked. But for some reason, it won’t move the player. (No error in output)

Heres the script:

local MoveInto = script.Parent.MoveTo
local Click = script.Parent.ClickDetector


Am I missing something?

Thank you :slight_smile:

1 Like

Where is this script located? You might also want to make sure the player that clicked is the LocalPlayer.

The script is located inside a part with a clickdetector.

I don’t think you can use MoveTo with a local script. I might be wrong though

The :MoveTo() function can only be called on a humanoid, so do this:

local MoveInto = script.Parent.MoveTo
local Click = script.Parent.ClickDetector


Also if you are trying to teleport the player, just move the actual character.


Just to be sure it isn’t a Script with a RunContext of client?

A LocalScript can only run in these places:

  • StarterGui
  • StarterPlayerScripts
  • StarterCharacterScripts
  • ReplicatedFirst
  • StarterPack

Make sure it is in one of these places, it sounds like it isn’t right now. Or, just use:

  • A normal Script
  • A Script with the RunContext set to Client

This isn’t quite right, the character also has a method called MoveTo. It doesn’t walk the character to the position, but it moves the PrimaryPart - so it teleports you, a bit like :PivotTo and setting the HumanoidRootPart.CFrame.

@PieFaceChamp_2 your problem is that, its a local script you need just a normal script isnide of the part along the aside the click detection as well this works perfectly fine.

local Part = script.Parent.Parent.Part


This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.