So, I'm using Berezaa's tycoon kit, and it saves the money inside of serverstorage. I wrote this script to try to give +10000 cash if the player has the gamepass, but it won't do anything.
(And yes, I do have the ID defined, it's just in the very first part of the script)
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) if game:GetService("GamePassserivce"):PlayerHasPass(player, id) then local swag = game.ServerStorage.MoneyStorage.Player.Value swag = swag + 10000 end end) end)
Your error is on line 6. The variable "swag" is saved as the value's data, not the actual value itself. You need to make "swag" the value instance instead of its data. This means you must use swag.Value every time you want to change it. I understand it's a pain, but it's how things must be done.
Check this out:
game.Players.PlayerAdded:connect(function(player) player.CharacterAdded:connect(function(character) if game:GetService("GamePassserivce"):PlayerHasPass(player, id) then local swag = game.ServerStorage.MoneyStorage.Player swag.Value = swag.Value + 10000 end end) end)