Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how to constantly check if a players cash has been changed?

the players cash is in a folder in serverstorage to prevent exploiting and is named whatever the players name is. how would I constantly check if any players cash has been changed? i've been at this for over a hour and am honestly so lost. this is all I have come up with


Players = game:GetService("Players")

for i, player in pairs(Players:GetPlayers()) do
	   cash = game.ServerStorage.PlayerMoney.player.Name
	cash.Value.Changed:connect(function() 
		print("changed")
	end)
		
	
end



2 comments

0

If the cash is in server storage then it is inaccessible to clients? Therefore there is no need to check this? Even if the cash were accessible to the client and exploiters changed it, it would be like inspect element; it doesn't change the text of the website for anyone else, only you.

0

this is all going to be for a cash gui that updates when the players cash has been changed. I will eventually use a remote event to send the information to the client.

1 answer

✓ Accepted answer
local Players = game:GetService("Players")

for i, player in pairs(Players:GetPlayers()) do
     local cash = game.ServerStorage.PlayerMoney[player.Name]
    cash.Changed:connect(function() 
        print("changed")
    end)
end

5 comments

0

-1. No explanation was given, and clearly you didn't read the comment I wrote.

0

Does it fucking matter?

0

this didn't work. would it need to be put in a while loop so it constantly checks?

0

this partly answered my question, I just had to add a little more. thanks!

This discussion is preserved as it was. New answers, comments, and votes are closed.