Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

why wont this script work?

Asked by
Benqazx 108
8 years ago

Please make your question title relevant to your question content. It should be a one-sentence summary in question form.
local player = game.Players.LocalPlayer
local char = player.Character
repeat wait()
until char:FindFirstChild("Humanoid").Health == 0
if char:FindFirstChild("Humanoid").Health == 0 then
    local all = char:GetChildren()
    for i,v in pairs(all) do
        if v.ClassName == "Tool" then
            v:Clone().Parent = player.Backpack
        end
    end
end

this script does not work. it is a script so that if the player has a tool in character it then this script will clone that tool when players health = 0.

0
Use Humanoid.Died:connect() instead Im_Kritz 334 — 8y
0
XXahraternotXX is correct, but I'm also confused as to why you're cloning the tool to the player's backpack, in which they will die and lose it. If you don't want them to use it, Destroy() it Shawnyg 4330 — 8y
0
i dont want the tool to be destroyed when the player dies. i was told that clone the tool from player character then paste it in backpack to prevent that but it is not working. is there a way to stop the tool from being destroyed when player dies? Benqazx 108 — 8y

Answer this question