So here's my script,
((Note, i did indent, the forums just weren't acting right))
function added(player) game.Players.LocalPlayer.PlayerGui.Backpack.Size = game.Players.LocalPlayer.PlayerGui.Backpack.Size.Value +1 end game.Players.PlayerAdded:connect(added)
Now i need it to add +1 value?
I've tried
function added(player) wait(10) game.Players.LocalPlayer.PlayerGui.Backpack.Size = game.Players.LocalPlayer.PlayerGui.Backpack.Size.Value +1 end game.Players.PlayerAdded:connect(added)
Just for the sake of seeing if the size would +1.
If anyone can help, that be great.
In the assignment, you're saying
(...).Size = (...).Size.Value
You should be setting Size.Value
on the left, not just Size
.
In addition, you're using PlayerAdded
but modifying the LocalPlayer
. This means that whenever anyone else joins, you will add one point. A LocalScript doesn't load quickly enough that it can capture its own player joining, so nothing will happen if you just launch this.
Blue was right. You have the variable 'player' for the Player that joined, then you went to use 'game.Players.LocalPlayer'. Also, you are making the 'Size' equal 'Size.Value' + 1, which should be 'Size.Value' being 'Size.Value' +1.
function added(player) player.PlayerGui.Backpack.Size.Value = player.PlayerGui.Backpack.Size.Value +1 end game.Players.PlayerAdded:connect(added)
That will fix the error in the script. However, you still have the issue of whatever 'Size' is not existing the exact moment that the Player joins. I honestly do not know what you are doing, here. You're adding 1 to the Value of 'Size' inside of something called 'Backpack' in the PlayerGui...but, why? You only want this to happen on the first time that they spawn? Because you are making this happen only once, when the Player joins the game.