what the title says
if you dont understand watch this:
Server Script:
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
local infiniteTool = script.Tool:Clone()
infiniteTool.Parent = plr.Backpack
end)
end)
If I’m understanding this correctly. This might work.
Put this in starter character scripts
local player = game.Players:GetPlayerFromCharacter(script.Parent)
local tool = game.ServerStorage:WaitForChild(“ToolName”)
local humanoid = script.Parent:WaitForChild(“Humanoid”)
tool.Parent = player.Backpack
humanoid.HealthChanged:Connect(function()
If Health < 5 then
tool.Parent = game.ServerStorage
humanoid.Health = 0
end
end)
you might want to make a script that would duplicate this for when a player joins. This will probably crash if there is more than 1 player
To make it more advanced for EVERY child in the script
game.Players.PlayerAdded:Connect(function(plr)
plr.CharacterAdded:Connect(function(char)
for _, tool in pairs(script:GetChildren()) do
if not tool:IsA('Tool') then return; end
local clone = tool:Clone()
clone.Parent = plr.Backpack
end
end)
end)
it only works once
I edited it. Maybe it will work now?
Not saying that @Escape_Everything is not on the correct path here, but instead of going through the hassle of getting the new player added everytime the humanoid is killed; Just do what I did and run something everytime a character is added… No it does not replicate to each player when one person dies either.
To add, mine basically works the exact same way but think of it as firing humanoid.Died
after the humanoid has died and respawned.
I think for some reason he does not want the tool to be cloned at all, but rather have it always be in the players inventory.
Doesn’t really make sense to do it that way but I’m just a little stupid.
Don’t worry about it, it seems as if he figured it out. To my next topic I guess.