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

Freeze Player not working, any help is appreciated also why?

This is from the Freeze Script

wait(.5)

local play = game.Players.LocalPlayer

function happe()
	coroutine.resume(coroutine.create(function()
		repeat wait(5) until play.Backpack:findFirstChild("Primary") ~= nil
		play.Backpack:findFirstChild("Primary").Active.Value = false
	end))
end

happe()

play.Character.Humanoid.WalkSpeed = 0

play.Character.Humanoid.Changed:connect(function()
	play.Character.Humanoid.Jump = false
end)

And this is from my main script inputting it into the player

for i, v in pairs (game.Players:GetChildren()) do
		if v:findFirstChild("PlayerGui") ~= nil then
			if v.PlayerGui:findFirstChild("MapLoad") ~= nil then
				v.PlayerGui.MapLoad:Destroy()
			end
		game.ServerStorage.OVERLORD.SERVER.SPAWN:clone().Parent = v.PlayerGui --EquipGuns
		game.ServerStorage.OVERLORD.STORAGE.GUI.FreezePlayer:clone().Parent = v.PlayerGui --FreezePlayers
		end
	end
	
	game.ServerStorage.OVERLORD.STORAGE.GUI.Countdown:clone().Parent = game.StarterGui
	game.ServerStorage.OVERLORD.STORAGE.GUI.SpawnMenu:clone().Parent = game.StarterGui
	game.ServerStorage.OVERLORD.STORAGE.GUI.FreezePlayer:clone().Parent = game.StarterGui
	
--GameBegin()
	game.StarterGui:findFirstChild("Countdown"):Destroy()
	game.StarterGui:findFirstChild("SpawnMenu"):Destroy()
	game.StarterGui:findFirstChild("FreezePlayer"):Destroy()

1 answer

Well, you didn't provide enough information on any errors and whatnot, but I can try to help.

Instead of repeatedly setting the Humanoid's WalkSpeed to 0, you can just anchor the HumanoidRootPart all together. It'd look something like this:

wait(0.5)

local play = game:GetService("Players").LocalPlayer

function happe()
    coroutine.resume(coroutine.create(function()
        repeat wait(5) until play.Backpack:findFirstChild("Primary") ~= nil
        play.Backpack:findFirstChild("Primary").Active.Value = false
    end))
end

happe()

play.Character:WaitForChild("HumanoidRootPart").Anchored = true -- this will prevent any sort of movement from the player.

play.Character:WaitForChild("Humanoid"):GetPropertyChangedSignal('Jump'):Connect(function()
	Character.Humanoid.Jump = false -- Disables the player from even attempting to jump, although anchoring the HumanoidRootPart already does it.
end)

Let me know if this isn't the case and something else is broken.

1 comment

0

As far as resetting goes, you'll want to have a CharacterAdded event added on to there.

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