**Cool Script
**
Script Solved
-5 Coins When Players Dies
So first make a local script inside starter character scripts. Then inside you want to write:
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
Character.Humanoid.Died:Connect(function()
Player.leaderstats.Coins.Value - 5 --Change the name of the value if needed
end)
Make a Script and place it inside ServerScriptService.
local CoinTakeAway = 5
game.Players.PlayerAdded:Connect(function(Player)
Player.CharacterAdded:Connect(function(Character)
local Humanoid = Character:WaitForChild("Humanoid")
Humanoid.Died:Connect(function()
Player.leaderstats.Coins.Value -= CoinTakeAway
end)
end)
end)
Your Script won’t work on server because it’s a LocalScript, other player won’t see it. Use my script instead will prevent this problem,
But shouldn’t it work though since it’s changing something everyone can see? I’m still learning too so thanks for correcting me.
I don’t really understand which one going to work…
I was getting this problem when I started learn how to script! Remember, LocalScript only change and make our player see, not the whole server. So if you want the whole server to see, use Script instead. Both will work, but I prefer mine because it would make everyone see your coins got subtracted. If you want to run something in a LocalScript and make it on Server, use RemoteEvent.
Do @OriChanRBLX his is correct.
Thanks To Both of You @OriChanRBLX & @SilentSuprion