How would I get info from the client

So I have a notification system which pops up (roblox’s notification system)

and I am making a if statement if a player has enough cash and has a boolvalue checked. Now you see the boolvalue is changed on the client so that everyone doesn’t have that boolvalue checked. You see I don’t know how to get info from the client (boolvalue) so that I can have it working.

I know I could use a remoteevent but how would I use it in this script?

	local Cash = player.leaderstats.Cash
	
	Cash.Changed:Connect(function()
		if Cash.Value >= 5000 then
			event:FireClient(player,"Hey!","You can buy the candy area!")
		end
	end)

This should work if the script is on the server? Don’t change cash on the client because an exploiter can just directly edit the value. Always trust the server over the client.

I’m slightly confused, are you trying to send the information to a server-sided script?

yes I am trying to send info from client to server

I am trying to get the info of a boolvalue from the client

In this case, you’ll want to replace :FireClient() with :FireServer(). Also, there’s no need to send the player since it’s automatically sent by the Client.

btw the event in the script is the notification it has nothing to do with cash and boolvalues

So the event in the script is actually to be sent to the Notification Script, correct? I recommend checking the cash on a server-sided script as @lanjtlike stated above since exploiters have control of the client, making it easy for them to mess up with their cash value

Why do you want to get a boolvalue from the client though?

the value is checked if a player owns it I want the script to know if its true or false

Then an exploiter can just return true 100% of the time. Why dont you just put the boolvalues inside the player on the server? I don’t understand why it needs to be on the client anyways.

but wouldn’t the area wall will be not appearing for everyone? I want it so that people who own it will get that checked. I am very curious I will try doing that.

If you need the client to send/transmit data to the server then you will need to call “:FireServer()” on/through a RemoteEvent instance, then in some server script you will need to listen for this event to fire with the “OnServerEvent” event of the same RemoteEvent instance.

Here’s an extremely trivial example to demonstrate.

--CLIENT

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage:WaitForChild("RemoteEvent")

RemoteEvent:FireServer()
--SERVER

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local RemoteEvent = ReplicatedStorage.RemoteEvent

RemoteEvent.OnServerEvent:Connect(function(Player)
	print(Player.Name, Player.UserId)
end)

This implementation requires a single “RemoteEvent” instance named “RemoteEvent” (default name).