i have a model, which is the ring of the sell part, and a hitbox. the hitbox is just an invisible part. inside of the hitbox, i have a local script
Use script (no local script) because you will want to save the value later.
The script will change like this:
script.Parent.Touched:Connect(function(hit)
if hit.Parent:FindFirstChild("Humanoid") then --detect player
game.Players[hit.Parent.Name].leaderstats.Coins.Value += game.Players[hit.Parent.Name].leaderstats.UndiePower.Value --add value from "UndiePower"
game.Players[hit.Parent.Name].leaderstats.UndiePower.Value = 0 --set "UndiePower" to 0
end
end)
no error showed, but the leaderstat values didn’t change
you must use a server script wherever value is modified