I need help, heres my script.
game.Players.PlayerAdded:Connect(function(plr)
if plr.leaderstats.GoBux.Value >= 100 then
local clone = game.ServerStorage.Card2:Clone()
clone.Parent = plr.Backpack
end
end)
I’m trying to give a player a tool when they have a specific amount of Cash.
the player might not have a leaderstats folder because they just joined
if the player did have a leaderstats folder, the gobux variable would have a value of 0 by default. you need to load the value first, and then check if they have a certain amount of cash.
You would use WaitForChild, so the values can load in.
if plr:WaitForChild("leaderstats"):WaitForChild("GoBux").Value ~= nil then
if plr:WaitForChild("leaderstats"):WaitForChild("GoBux").Value >= 100 then
--- Do other stuff