this is the lines where the script don't work. It works perfect in studio but not in game. The tools in StarterGear won't be destroyed even if "keepAfterRe" is false.
local items = player.StarterGear:GetChildren() for i = 1, #items do if items[i].keepAfterRe.Value == false then items[i]:Destroy() end end local char = player.Character local h = char:FindFirstChild("Humanoid") h.Health = 0
If there is no error then your problem is probably you didn't use :WaitForChild()
. Try it before saying it's not the problem.
local items = player.StarterGear:GetChildren() for i = 1, #items do if items[i].keepAfterRe.Value == false then items[i]:Destroy() end end local char = player.Character or player.CharacterAdded:Wait() -- or makes it so that if player.Character is nil than it goes to player.CharacterAdded:Wait() local h = char:WaitForChild("Humanoid") -- WaitForChild h.Health = 0 h.Health = 10000000 - h.Health -- just in case
I hope you have your ends. But, give it a try. If this helped you, please Upvote and accept answer.
-- Your orange, BlackOrange3343