Hi, I have a datastore script that saves likes its suppose to, but when I click the gui that gives me money and leave it doesnt work. I tried going on console and giving myself money and I left, it worked. I think somethings wrong with the gui but I dont know what. It shows its changing the money but it doesnt save it. Heres the script
local player = game.Players.LocalPlayer script.Parent.MouseButton1Click:Connect(function() player.leaderstats.Money.Value = player.leaderstats.Money.Value + 1 end)
You cannot alter an instance via local script if your game has FilteringEnabled
on, which it should. Instead, you will have to approach the problem with a RemoteEvent
.
Check out this page on the Roblox documentation for examples of how to use remote events.