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

How do I freeze a player when joined in R6?

I tried making a freeze script for my game but it won't work. Here's my code.

function onJoined(newPlayer)
	newPlayer.Character.Humanoid.WalkSpeed = 0
end

game.Players.PlayerAdded:connect(onJoined)

While making a script and putting it into Studio and testing it. The player still can walk.

2 comments

0

really? it should do what it is suposed to do nothing is wrong

0

What exactly are you trying to do? Freeze R6 players or fix the script you have given us? You're giving an XY problem.

3 answers

you can anchor the primary part (HumanoidRootPart)

function onJoined(newPlayer)
    newPlayer.Character.PrimaryPart.Anchored=true
end

game.Players.PlayerAdded:connect(onJoined)

make sure its a server script

4 comments

0

yah do this

0

There is still a problem. They can reset.

0

then disable the reset button. I don't remember how to do it but its possible

0

But if you change the script a little bit and put it into starter character scripts that will work

game.Players.PlayerAdded:Connect(function(player)
	player.CharacterAdded:Connect(function(character)
		local humanoid = character:FindFirstChild("Humanoid")
	end)
while true do
if humanoid.RigType == Enum.HumanoidRigType.R6 then
   character.Torso.Anchored = true
   humanoid.Died:Connect(function()
		wait()
		player:LoadCharacter()
     end)    
end

Please tell me if I’m wrong because I’m on mobile and cannot test the script

I think THIS is what you're looking for:

wait()
pcall(function()
	game:GetService("StarterGui"):SetCore("ResetButtonCallback", false) -- Player can't reset
end)

After this, you can anchor the HumanoidRootPart and the player will be stuck. Evil, but this is what you could do.

1 comment

0

The script must be local AND in StarterPlayerScripts

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