01 | db = false |
02 | script.Parent.Touched:connect( function (hit) |
03 | if hit.Parent:FindFirstChild( "Humanoid" ) then |
04 | local player = game.Players:GetPlayerFromCharacter(hit.Parent) |
05 | if not db then |
06 | db = true |
07 | script.Parent.BrickColor = BrickColor.new( "Bright red" ) |
08 | local plr = player.name |
09 | game.ServerStorage.PlayerMoney.plr.Value = game.ServerStorage.PlayerMoney.plr.Value + 10 |
10 | wait( 3 ) |
11 | script.Parent.BrickColor = BrickColor.new( "Bright green" ) |
12 | db = false |
13 | end |
14 | end |
15 | end ) |
on line 8 where you make the variable "plr" You never use it later on.
If you are trying to find a child in PlayerMoney with the name of the players name you should do
1 | local plr = player.Name |
2 | game.ServerStorage.PlayerMoney:FindFirstChild(plr).Value = game.ServerStorage.PlayerMoney:FindFirstChild(plr).Value + 10 |
I agree with PoePoeCannon's answer, but I'll explain it a little bit more.
game.ServerStorage.PlayerMoney.plr.Value = game.ServerStorage.PlayerMoney.plr.Value + 10
isn't a valid command. if you're trying to find something by using a changing-name. (i.e. player name) you should use [] instead of a period. If this doesn't make since, then this might
game.ServerStorage.PlayerMoney[plr].Value = game.ServerStorage.PlayerMoney[plr].Value + 10