Stats not saving

local event = game.ReplicatedStorage:WaitForChild("DeductCoins")
local CoinsStore = game.Players.LocalPlayer.coinsstore.Coins.Value
script.Parent.MouseButton1Click:Connect(function()
	script.Parent.Sound:Play()
	game.Players.LocalPlayer.coinsstore.Coins.Value = game.Players.LocalPlayer.coinsstore.Coins.Value -100
	event:FireServer(game.Players.LocalPlayer.coinsstore.Coins.Value)
end)

this script has been messing with my mind i genuinely have no idea how to get the event to fire im desperate any help on how to correctly use events and such will be greatful

The main usage for a remote event would be to perform actions that you wouldn’t want the client to do themselves. (such as changing how much money a player has).

Possible Mistakes:

  • Using an IntValue under the player on the client

  • Instead of
    game.Players.LocalPlayer.coinsstore.Coins.Value = game.Players.LocalPlayer.coinsstore.Coins.Value -100
    do
    CoinStore += 100

Possible troubleshooting:

  • You’re referencing an object under the player. (CoinStore). Make sure you manually created in a script, otherwise theres no way it would actually exist

  • Do you have a server script listening to the event (using .OnServerEvent) that also accepts the player as the first parameter?

If you’re feeling stressed, you really ought to take a break, come back and do more research. The link explains all of my notes in a more beginner-friendly manner.

2 Likes