Unable to cast value to Object with remote event

so i have this script that pastes a number value onto a text label. i get the error

Unable to cast value to Object

and this is the script.

while wait() do
	print(values.CashValue.Value) -- 'values' being a folder and 'CashValue' being a number value
	
	game.ReplicatedStorage.CollectCash2:FireClient(values.CashValue.Value)

end

im not really sure what to do

The first parameter to FireClient should be the player you wish to fire the event to.

3 Likes

ok sorry this is gonna sound really stupid but ive just like lost all thought or something

what would the player be in this?

The player who collected the cash or if you’re trying to send the event to everyone, use FireAllClients instead

2 Likes

It would be the player whose TextLabel you are trying to update.

i ended up just realizing you could put the function in the localscript and it worked without remote events. thank you for the help!

Well how do you do… This certainly helped me and I am able to finish my code. Thank you Mr. [HugeCoolboy2007].