So I have this gamepass where it would clone a boombox (tool) from the ReplicatedStorage into a player's backpack, using a regular script in the ServerScriptService. The script works at first, but if the player respawns, the boombox doesn't clone again. Thank you for reading.
(The actual boombox is in a folder called "tools")
local storage = game:GetService('ReplicatedStorage')
local tools = storage:WaitForChild('tools')
local dir = {
{tools.BoomBox}
}
local id = 4171710
game.Players.PlayerAdded:connect(function(player)
if game:GetService("MarketplaceService"):UserOwnsGamePassAsync(player.UserId, id) then
for key, value in pairs(dir) do
local tab = value
for t = 1, #tab do
wait ()
local clone = tab[t]:Clone()
print("clone")
clone.Parent = player:WaitForChild('Backpack')
print("clone.Parent")
end
end
else
print(player.Name .. " doesn't have the boombox. Sad.")
end
end)

2 comments
It worked, thx!
or just like...put it in startergear, so they spawn with it when the join the game