Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Disable player movement if on a part?

Hello, I want to make a block that disables player movement.

How would I go about this?

Thanks

1 answer

✓ Accepted answer

Inside the the part, add in a Script and type this

script.Parent.Touched:Connect(function(hit)

	if hit.Parent:FindFirstChild("Humanoid") then
		local player = game.Players:GetPlayerFromCharacter(hit.Parent)
		if player then
			local humanoid = player.Character:WaitForChild("Humanoid")
			humanoid.WalkSpeed = 0
			-- add "humanoid.JumpPower = 0" if you want the player not to have jump height too.
		end
	end

end)

2 comments

0

Do you know how to implement this into a local script also?

0

@Helloimpets LocalScript usually wouldn't work because it would only apply to the client and not the entire server. I may be wrong though.

This discussion is preserved as it was. New answers, comments, and votes are closed.