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

How do I Stop a Player from moving their character?

Asked by 6 years ago
Edited 6 years ago

This may be a little hard to explain, but what i'm trying to do is move a character's humanoid to a position, but the problem is as the script move em, they're still able to move their own character, which stops the script from moving the humanoid to a certain part. For an example "hum:MoveTo(pa)" that will walk them to that point, but if they walk a different direction by using the W,A,S,D keys then it will no longer move em to "pa", so how do I move a player to a part with the W,A,S,D keys disabled (as in they cannot move their character, but their speed is at 50)

wait(3)
local p = game.Players.LocalPlayer
local char = p.Character or p.CharacterAdded:wait()
local hum = char:WaitForChild("Humanoid")
local pa = game.Workspace.lel.Position

while true do
wait()
hum.WalkSpeed = 16
print("moving...")
wait(0.1)
hum:MoveTo(pa)
hum.MoveToFinished:wait()
print("working")
end

It is possible, there are certain game that have this.

1
.Torso.Anchored = true simplest method protectiveebob 221 — 6y
0
@protectiveebob If the torso is anchored, wouldn't the player not be able to move at all? I'll try it later, at school right now, lol. IIApexGamerII 76 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

First, set their walk speed to 0 in case they are moving.

After that, disable "ControlScript" in the player>PlayerScripts.

Then set the walk speed back to normal.

Example:

script.Parent.Touched:Connect(function(part)
local h = part.Parent:FindFirstChild('Humanoid')
if h then
local player = game.Players:GetPlayerFromCharacter(part.Parent)
if player then
h.WalkSpeed = 0
player.PlayerScripts.ControlScript.Disabled = true
h.WalkSpeed = 16
end
end)

The script is untested, and is just an example, but you get it right?

0
Did not fully answer my question, but It helped me in a way. IIApexGamerII 76 — 6y
0
Nvm forget about ^ it fully helped. IIApexGamerII 76 — 6y
Ad

Answer this question