My script that with a value, you get a shirt, isn’t working, I have no idea if its because i have 2 leaderstats, instead of just 1, but any help? Heres the script.
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) if player:WaitForChild("leaderstats").Money12.Value>= 1 then print("player.leaderstats.Money12.Value") character.Shirt:Destroy() end lol = script.Parent.Shirt:Clone() lol.Parent = character end) end)
There are a few potential issues here. I want to enumerate them and I'll finish the post with suggested changes.
I have assumed that objects have stayed in the same spot with these edits here. Though I highly suggest implementing 1 and 2 yourself.
-- I'm throwing this in a variable so its easier to edit in the future. -- Its a good practice to put "constants" or values that will basically stay -- the same but are specific here. local shirt = script.Parent.Shirt game.Players.PlayerAdded:connect(function(player) -- I have changed the event here. player.CharacterAppearanceLoaded:connect(function(character) -- I have split up the leaderstats check because I -- think this may prove useful in the future. This -- may for example be replaced with a changed event -- for the money12 value. if player:FindFirstChild("leaderstats") then if player.leaderstats.Money12.Value >= 1 then if character:FindFirstChild("Shirt") then character.Shirt.ShirtTemplate = shirt.ShirtTemplate else local newshirt = Instance.new("Shirt") newshirt.Name = "Shirt" newshirt.ShirtTemplate = shirt.ShirtTemplate newshirt.Parent = character end end end end) end)