This is the script:
script.Parent.Touched:connect(function(hit) print("he") if hit:FindFirstChild("Mesh") then local plv = game.Workspace.Jobs.Coffee.PlayersInArea:FindFirstChild(hit.PlayerName.Value) plv.Value = plv.Value + 100 end end)
But when I touch this block in a server it doesn't even print "he".
(You can probably ignore the 'if' part, but I'm leaving it in because it might be important.)
In line 4, the location of the players username (hit.PlayerName.Value) The PlayerName cannot be accessed here, hit is what has hit the part.
To find the username you would have to do: PlayerName = hit.Name (Hit would be the players character model, the name of the model would be the players name.)
game.Players.PlayerName.Value = game.Players.PlayerName.Value + 100
This accesses the value that i am assuming is in the Players folder. Since PlayerName is the name of the Player, the code is basically telling itself (If i was the player that hit the part)
game.Players.Kulh.Value = game.Players.Kulh.Value + 100
Example:
script.Parent.Touched:connect(function(hit) print("he") if hit:FindFirstChild("Humanoid") then -- If a player hits it local plv=game.Workspace.Jobs.Coffee.PlayersInArea:FindFirstChild(hit.Name) -- Gets model name (Player's Name) game.Players.plv.Value = game.Players.plv.Value + 100 -- Goes to the Players folder and locates the player by it's name (plv is the Players name) and adds 100 to the Value end end)