I have a Text gui when pressed it’s suppose to move the player, here’s the script(LocalScript in TextButton):
local function onTouchTap()
local RL = game.ReplicatedStorage:WaitForChild("Players"):WaitForChild("MobileLeft")
game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):Move(Vector3.new(0, 0, -1), true)
end
local function Released()
game.Players.LocalPlayer.Character:WaitForChild("Humanoid"):Move(Vector3.new(0, 0, -1), false)
end
script.Parent.MouseButton1Down:Connect(onTouchTap)
script.Parent.MouseButton1Up:Connect(Released)
You must use RemoteEvents for this. From my understanding, I don’t think you can move players from the Client since other players are unable to view it. Simply make a RemoteEvent and fire it whenever a button is pressed, then move the player from the Server.
You are going to have to hook the click event more than once, or bind to UserInputService and control the event more rigorously, i.e. when the click begins, as it continues, and when it ends, and continually fire RemoteEvents to fire the movement to happen (probably over some granulated time-scale).
If it’s a normal player and not anchored by the server, you can move from the client. That’s exactly how normal roblox movement works. It’s client authoritative.
Aight never used this function before so had to look it up. First of all the second argument you pass to Move doesn’t mean what you think it does. It’s a boolean called “relativeToCamera”, so you use it to enable or disable the movement direction being applied according to the camera. Therefore when you call it again in released with false, it’ll just send your guy moving in a different direction.
The second thing you need to do is go under StarterPlayer and set the default movement mode to Scriptable, because otherwise
When this function is called, the Humanoid will move until the function is called again. However, if the default control scripts are being used this function will be overwritten when called on PlayerCharacters. This can be avoided by either not using the default control scripts, or calling this function every frame using RunService:BindToRenderStep() (see example).
This is all clearly written in the documentation so give that a look next time.
And then lastly, you can fix your released function by setting the moveDirection vector to 0, 0, 0.