Hello, i tried to make a script that saves my weapons when i die. But it dont work because it adds them directly, or when i add a “wait”, it waits until the weapons replaced and then respawns.
Im not good at explaining but if you take a look in the code maybe you know hat i mean
local Player = game.Players.LocalPlayer
local Character = Player.Character
local Humanoid = Character:WaitForChild'Humanoid'
local HK33 = game.ReplicatedStorage:WaitForChild("Tools"):WaitForChild("HK33")
local HK33Clone = HK33:Clone()
local HK416 = game.ReplicatedStorage:WaitForChild("Tools"):WaitForChild("HK416")
local HK416Clone = HK416:Clone()
local MP5 = game.ReplicatedStorage:WaitForChild("Tools"):WaitForChild("MP5")
local MP5Clone = MP5:Clone()
local QBU88 = game.ReplicatedStorage:WaitForChild("Tools"):WaitForChild("QBU-88")
local QBU88Clone = QBU88:Clone()
while wait() do
Humanoid.Died:Connect(function()
if Player.Backpack:FindFirstChild("HK33") then
HK33Clone.Parent = Player.Backpack
end
if Player.Backpack:FindFirstChild("HK416") then
HK416Clone.Parent = Player.Backpack
end
if Player.Backpack:FindFirstChild("MP5") then
MP5Clone.Parent = Player.Backpack
end
if Player.Backpack:FindFirstChild("QBU-88") then
QBU88Clone.Parent = Player.Backpack
end
end)
end