How can I freeze other players and not myself?

This should be something very basic, but even with the condition I passed in my if statement, my character still gets frozen. My stand doesnt freeze though with the condition I pass. How can I freeze other players and not myself.

local partsInWorkspace = workspace:GetDescendants()

	for i = 1, #partsInWorkspace do
		local thatPart = partsInWorkspace[i]

			if thatPart:IsA('BasePart') then
				if thatPart.Anchored == false and thatPart.Parent.Name ~= "Star Platinum" and thatPart.Parent.Parent.Name ~= Player.Name then
						thatPart.Anchored = true
						table.insert(plrTbl, thatPart)
				end
			end
		end

		task.wait(5)


		for i = 1, #plrTbl do
			plrTbl[i].Anchored = false
		end
		table.clear(plrTbl)
1 Like

You can do it by looping through all the players and freezing them but yourself like so

for i, oPlayer in pairs(game:GetService("Players"):GetChildren()) do
	if oPlayer.Name ~= player.Name and oPlayer.Character then
		for _, v in pairs(oPlayer.Character:GetDescendants()) do
			if v:IsA("BasePart") or v:IsA("MeshPart") or v:IsA("UnionOperation") then
				v.Anchored = true
			end
		end
	end
end

You can manually set your parts anchored to false with a for i,v in pairs(character:GetDescendants()) function.

I believe setting the humanoid’s (well, this is assuming that you’re using the roblox characters) walk speed to 0 would be a better practice in this case.

EDIT: Jump power as well, if you need the players to not move at all

Exploiters can bypass the freeze by changing their walkspeed back to normal or teleporting, I think anchoring player character would be better.

Can they really do that, if you change their walkspeed on the server?

EDIT: By that logic, can’t they unanchor their character as well, then?

they won’t be able to unanchor their character if it’s anchored on the server sided. but they can change their WalkSpeed

Weird, how and why does that work that way?

I don’t really know but it just works

Are you sure that there weren’t any remotes changing players’ walkspeeds, in the games that you’ve seen this done?

nope, i tried using roblox studio command bar and it works

1 Like