script.Parent.Touched:Connect(function(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) local cash = plr.leaderstats.Cash cash.Value = cash.Value +5 R:FireAllClients() print('Recived') end)
---This part it is in Replicated storage, I made a script that when you click a part, the part in replicated storage (this one) duplicates and goes to Workspace and when a player hits it what it says in the script is what it does. But is not doing anything.
just use a new remote event to fire to the specific user for the cash
script.Parent.Touched:Connect(function(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) local cash = plr.leaderstats.Cash NewEvent:FireServer R:FireAllClients(plr) print('Recived') end)
script in serverScriptService
NewEvent.OnServerEvent:Connect (function(player) player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 5 end)