script.Parent.Touched:Connect(function(hit)
local char = hit.Parent
local plr = game.Players:GetPlayerFromCharacter(char)
coin = script.Parent
if plr then
game.ReplicatedStorage.CoinFire:FireClient(plr, coin)
end
end)
--Sever script inside coin part
local var = true
game.ReplicatedStorage.CoinFire.OnClientEvent:Connect(function(plr, coin)
if var == true then
plr.leaderstats.Coins.Value = plr.leaderstats.Coins.Value + 5
var = false
end
coin:Destroy()
end)
--Local script inside playergui
Error: leaderstats is not a valid member of MeshPart "Workspace.Stage1.Meshes/coin"
There is a coin and when the player touches it I want the coin to give coins and disappear for the player

1 comment
Thank you!