This script is inside of a button that, when clicked, is supposed to lower your Money leaderstat, (it does this) raise a value, and make a GUI pop up on your screen for a short time. (it doesn't do any of this) Originally, the LocationsPercentage was to be raised by 0.05. I tried making it a non-decimal number to see if it would work then, and it did. Why doesn't arithmetic was decimals work? Even with the LocationsPercentage arithmetic working, the GUI doesn't pop up. Nor does it pop up if you don't have $10k. If you click it while your Money stat is under $10k, literally nothing happens. This is especially confusing because I have this script implemented in many other places around the game and it works fine there. What the heck? Edit: The script is a LocalScript, as are all of the scripts where this script works.
script.Parent.MouseButton1Click:Connect(function()
local Money = game.Players.LocalPlayer.leaderstats.Money
if Money.Value < 10000 then
game.Players.LocalPlayer.PlayerGui.Folder.NotEnoughMoneyGui.Frame.Visible = true
wait(2)
game.Players.LocalPlayer.PlayerGui.Folder.NotEnoughMoneyGui.Frame.Visible = false
elseif Money.Value >= 10000 then
Money.Value = Money.Value - 10000
game.Players.LocalPlayer.LocationsPercentage.Value = game.Players.LocalPlayer.LocationsPercentage.Value + 0.05
game.Players.LocalPlayer.PlayerGui.Folder.SuccessfulPurchaseGui.Frame.Visible = true
wait(2)
game.Players.LocalPlayer.PlayerGui.Folder.SuccessfulPurchaseGui.Frame.Visible = false
end
end)

15 comments
If the "money" value is created by the server it must be changed by the server, use a remote event.
also, you can make your script alot simpler by adding some variables for things like the LocalPlayer
The money being changed is the only thing that DOES work - the problem is the rest of the script. Please read the post before commenting.
Adorable. So you're creating leaderstats locally?
money = money - 10000 smh... use remotes please.
I don't see the problem with using remotes when this works...
With not using remotes*
read my answer
FE is enabled - isn't that what makes games hack-proof? That little tick that makes them FE enabled in Workspace?
Please read the answer before commenting. Do some research into the issue before assuming that you're correct and we're wrong.
That's what the answer leads me to believe
If you keep your values Client side then you're a fool. Likely whats going on is you have them on the server, you're changing them on the client, and since it SHOWS to be changed on the client, you think you're right and they've been changed. You NEED to use a remote event for this to work.
The money is NOT the issue. If I have to make LocationPercentage 5 instead of 0.05 that is fine, I can work around that. The issue is the GUI - that part of the script works everywhere but in this one script for whatever reason. I don't see what values, clients, servers, and remoteevents/functions have anything to do with that.
Since you're the smartest person around, i suppose you can figure it out then.
Well I hope you learn how to store values on the server. If the value doesn't work, then the code beneath it won't work i'd assume