Limit of one of every item script

does this placement look right
Screenshot 2023-08-12 222955

Mhm, it does. Try and see if it works out.

it does not appear in my inventory when i start the game

What happens if you reset your character?

that doesnt work asswell
Screenshot 2023-08-12 223229

Try this instead.

local adminTools = game:service("ServerStorage"):WaitForChild("AdminTools")
local admins = {
    ["Diam0ndzOnYT"] = true
}

game:service("Players").PlayerAdded:Connect(function(player)
    if admins[player.Name] == nil then return end
    player:WaitForChild("StarterGear")
    player:WaitForChild("Backpack")
    for _, tool in ipairs(adminTools:children()) do
        tool:Clone().Parent = player.StarterGear
        tool:Clone().Parent = player.Backpack
    end
end)

it gives it to me but it sill dupes

wait hold on i think i found it

Strange. What happens if you remove the line that adds it to the Backpack as well?

the way i have the code it makes ALL items save upon death i dont think i can stop it from doing a certain item type

game.Players.PlayerAdded:Connect(function(player)
    player.CharacterAdded:Connect(function()
        local dupesPrevent = {}
        wait(1)
        for _, tool in ipairs(player.Backpack:children()) do
            if tool.ClassName == "Tool" and dupesPrevent[tool.Name] == nil then
                dupesPrevent[tool.Name] = true
            else
                tool:Destroy()
            end
        end
    end)
end)

Here an entire workaround for that. :xd:

1 Like

would i make this a new script or combine it with another one?

Either-or. Doesn’t make a difference.

I think the reason you have that error is because you have to put “game:GetService(“Players”)”

There was a missing ) after the last end. game:service is the same as game:GetService.

ah i see im trying it righ tnow

yooo it works if i add a wait(0) at the begining will it happen instantly

You could skip the 0 and just do wait().

i got it it all works now thank you so much :smiley: do you want me to leave credits to you in game desc

That’s up to ya. I would recommend in the future coming back to rewrite the system as it’s being held together by bandages at this time.