Works locally but not in server, tried many things and error line is 4, with code "attempt to index local 'player' (a nil value)". Script is below.
function onRespawned2(player) local player = game.Players.LocalPlayer local Character = player:FindFirstChild("Character") local pft = script.savedarmor:Clone() pft.Parent = player.Character player.Character.Humanoid.WalkSpeed = 0 pft.Disabled = false end function onSpawned(newPlayer) wait(1) onRespawned2(newPlayer) newPlayer.Changed:connect(function (property) if (property == "Character") then onRespawned2(newPlayer) local gui = script.Armorgui:Clone() end end) while true do if newPlayer.Character ~= nil then break end wait() end end game.Players.PlayerAdded:connect(onSpawned)