I'm using Berezaas tycoon kit, and it stores the money inside of
ServerStorage V MoneyStorage V Player (numvalue) and then the Value property in Player
Here's the code (yes the gamepass id is defined, its just in the script earlier)
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function() local swag = game.ServerStorage.MoneyStorage:FindFirstChild("player.Name") if game:GetService("GamePassService"):PlayerHasPass(player.userId, id) then swag.Value = swag.Value + 2500 end end) end)
You are searching ServerStorage
for something named "Player.Name"
and not the players name. Also there is no reason to use FindFirstChild
if you are not going to check if the object exists.
Also note that you are giving the player money every time he respawns. Which could be abused.
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function() local swag = game.ServerStorage.MoneyStorage:FindFirstChild(player.Name) if game:GetService("GamePassService"):PlayerHasPass(player.userId, id) and swag then swag.Value = swag.Value + 2500 end end) end)