Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

after the I rebirthed, I won't die nor does the tools in my StarterGear clear, why?

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

1 answer

✓ Accepted answer

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

2 comments

0

well... it was my bad, I accidentally looped it. Thanks for your reply, but for your sake, I'll accept answer.

0

Thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.