So basicall i got a respawn script in my dummy and also a script that gives me cash but after i respawn the dummy it doesn’t give me cash, why?
give cash script:
game.Players.PlayerAdded:Connect(function(plr)
local function died()
local leadestats = plr:FindFirstChild("leaderstats")
local humanoid = script.Parent.Humanoid
local goldStats = leadestats and leadestats:FindFirstChild("Cash")
if humanoid.Health == 0 then
if goldStats then
goldStats.Value = goldStats.Value + 30
end
end
end
script.Parent.Humanoid.Died:Connect(died)
end)
respawn script:
local Copy = script.Parent:Clone()
local NPC = script.Parent
local Humanoid
for i,v in pairs(NPC:GetChildren()) do
if v:IsA('Humanoid') then
Humanoid = v
end
end
if Humanoid then
Humanoid.Died:Connect(function()
wait(2)
Copy.Parent = NPC.Parent
Copy:MakeJoints()
Copy.KillForCash:Clone()
NPC:Destroy()
end)
else
warn('Cannot find Humanoid in Respawn Script!')
end