I'm trying to freeze a single player that steps on a platform but it freezes all players, I can't seem to get it working.
local Players = game:GetService("Players") local LocalPlayer = Players.LocalPlayer --testing workspace.TestPad.Touched:Connect(function(hit) LocalPlayer.HumanoidRootPart.Anchored = true end)
Server scripts can't use LocalPlayer since they are server sided and not client sided. Instead of using LocalPlayer.
We can find the player by using what put in the parentheses after the .Touched function.
Make sure this is in a server script in either the Workspace or ServerScriptService.
workspace.TestPad.Touched:Connect(function(hit) --Begin the function when the pad was touched if hit.Parent:FindFirstChild("Humanoid") ~= nil then --If the part that touched the pad's parent (the player) has a humanoid then hit.Parent.HumanoidRootPart.Anchored = true --If it does then anchor the player end end)
If this helped then please accept the answer.