Title says it all... Here's the script:
script.Parent.Touched:connect(function(hit) humanoid = hit.Parent:FindFirstChild("Humanoid") if humanoid ~= nil then hit.Parent.leaderstats.Cash.Value = hit.Parent.leaderstats.Cash.Value +script.Parent.Cash.Value script.Parent.Cash.Value = 0 end end)
Output: 20:26:36.266 - leaderstats is not a valid member of Model 20:26:36.268 - Script 'Workspace.Model.ToCollect.Script', Line 4 20:26:36.269 - Stack End 20:26:36.270 - Disconnected event because of exception
Btw this is not tested.
What this would I hope do is give cash if the cash value is inside leaderstats and i hope you inserted leaderstats into the player and it will double the cash and if you wanna change the cash recieved or taken there is a comment there
and then will wait 5 seconds before repeating process
local db = true local coolingtime = 5 script.Parent.Touched:connect(function(hit) if not db then return end local human = hit.Parent:findFirstChild("Humanoid") if human then db = false local cash = game.Players:GetPlayerFromCharacter(hit.Parent).leaderstats.Cash cash.Value = cash.Value + cash.Value --change here to change cash given wait(coolingtime) end end)