I need help, for some reason this only works for one player and I don’t know why.
Local script:
uis.InputBegan:Connect(function(key, gameprocessed)
if (not gameprocessed) then
if key.KeyCode == Enum.KeyCode.C then
if game.Workspace:FindFirstChild(plr.Name):FindFirstChild("Handcuffs") then
for i, v in pairs(game.Workspace:GetChildren()) do
if game.Players:FindFirstChild(v.Name) then
if v.Name == plr.Name then
return
else
local target = game.Workspace:FindFirstChild(v.Name)
if target.isCuffed.Value == false then
local magnitude = (game.Workspace.CurrentCamera.CFrame.Position - target.HumanoidRootPart.Position).Magnitude
if magnitude <= 15 then
game.ReplicatedStorage.cuffEvent:FireServer(target)
end
end
end
end
end
end
end
end
end)
Server Script:
game.ReplicatedStorage.cuffEvent.OnServerEvent:Connect(function(plr, target)
target.Humanoid.WalkSpeed = 0
target.Humanoid.JumpPower = 0
end)
So basically when testing with 2 players, one player can use the system and the other can’t.