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
Click.MouseClick:Connect(function()
game.Players.LocalPlayer.Character:MoveTo(MoveInto.Position)
end)
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
script.Parent.ClickDetector.MouseClick:Connect(function(player)
player.Character:MoveTo(Part.Position)
end)