Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to cancel the moving from a character but make it still walk with MoveTo()?

Asked by 4 years ago
Edited 4 years ago

okay so i have the code on how to move a character:

script.Parent.Touched:Connect(function(s)
    local position = Vector3.new(91, 0.5, 131.75)
    local humanoid = script.Parent:WaitForChild("Humanoid")
    humanoid:MoveTo(position)
end)

but i need to know how to make a character cancel its manual movement. (like have it controlled, but the player themselves cant manually move via arrow or wasd keys)

im planning to make a game like one of of those "tifany mayumi" gamer games.

pls help?

0
Im looking at this script, and im pretty sure that having humanoid:MoveTo(position) would only teleport the player to the place that you want without having it walk there. To disabled the wasd keys and stuff, I think it could be a good idea to make the players walkspeed 0 at the times you it to be controlled. guywithapoo 81 — 4y
0
you are thinking about model:MoveTo(). and the humanoid won't be able to move if its walkspeed is 0 megukoo 877 — 4y
0
but if i make the walkspeed 0, then the MoveTo() wouldnt work because the player cant move. :// harris38637 22 — 4y
0
i cant see how to make the MoveTo() able to work without having the player be able to manually walk. harris38637 22 — 4y

1 answer

Log in to vote
0
Answered by
SmartNode 383 Moderation Voter
4 years ago

You can use the context service for this:

local ContextActionService = game:GetService("ContextActionService")
local FREEZE_ACTION = "freezeMovement"

ContextActionService:BindAction(
    FREEZE_ACTION,
    function() return Enum.ContextActionResult.Sink end,
    false,
    unpack(Enum.PlayerActions:GetEnumItems())
)

--to unfreeze

ContextActionService:UnbindAction(FREEZE_ACTION)

original: here

0
is it supposed to be in all in one localscript? harris38637 22 — 4y
0
try it out for yourself and achieve your desired results SmartNode 383 — 4y
Ad

Answer this question