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

I am trying to make a freeze player script on touch?

I've been trying to find help making a script on where when a player touches the PART it freezes the player or players for a certain amount of time and then unfreezes them. If anyone could send me a script or comment one that would help me out SO much Thank you.

1 answer

This should work, but it freezes them mid air, so I will add two solutions.


script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		hit.Parent.HumanoidRootPart.Anchored = true	
		wait(3) --The time you want to wait
		hit.Parent.HumanoidRootPart.Anchored = false
	end
end)

Here is the other solution using player walkspeed. (Make sure they are regular scripts that are children of a part)

script.Parent.Touched:Connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") then
		local Humanoid = hit.Parent.Humanoid
		local originalWalkspeed = game.StarterPlayer.CharacterWalkSpeed
		Humanoid.WalkSpeed = 0
		wait(3) --The time you want to wait
		Humanoid.WalkSpeed = originalWalkspeed
	end
end)

It sometimes will freeze them right after, so if you want a toggle its super easy to script if you need me to show you how let me know! If it helps please accept my answer :)

1 comment

0

is it possible to disable the script once the player gets the originalspeed back so that the player doesnt freeze right after? if not thats okay

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