RemoteFunction really doesnt feel like firing

Button is in StarterGui, CD and prox. prompt are in workspace
image
image

Could you try MouseButton1Click instead of MouseButton1Down

Still not working, even had the same issue with a button not working before

Try putting the UIHandler below the cash button, probably won’t change anything but worth a test;

Acutally; do you have any errors in the Client Section of F9?

what’s the event script in serverscriptservice?

Client section on F9 is empty, putting UIHandler below cash doesnt work

Does it print anything when you click the button?

Jeremy gave me the script as mine wasnt working but i suspect its a client issue.

local Players = game:GetService("Players")
local Cache = {} --> Ratelimit them

ReplicatedStorage.GiveCash.OnServerEvent:Connect(function(Player, Amount)
	if type(Amount) ~= "number" then
		return -- Detects Passing a Non Number
	end

	if Amount ~= Amount then
		return -- Detects Passing NaN
	end

	if Cache[Player] and os.clock() - Cache[Player] < 0.5 then
		return --> If it gets fired one at a time in less then 0.5 seconds it will ignore it, this stops spamming it
end

Cache[Player] = os.clock()
Player.leaderstats.Cash.Value += Amount
end)```

It literally does nothing, i have a print(“fired”) on button click and it doesnt, heres a video

You are viewing the server preview, can I see the client?
image

Heres the client

Do

-- returns a boolean. If boolean is false (not successful execution) then it return the error too.
local success, error = pcall(function() end)

Instead of

local yes, no = pcall(function() end)

Also

-- if success ~= true then throw error otherwise do success functions
if not success then
	assert("ERROR:\n"..tostring(error)) -- same as error() but doesnt stop exec
	warn("giving cash failed, player "..player.Name.." ,reason "..no)
else
	print("gave cash to "..player.Name.." ("..player.UserId..") via button remoteevent")
end	

Additional improvements

--Dont do: cash.Value = cash.Value + amount
-- Do
cash.Value += amount -- this is the same just smaller.
--[[
These both add the current value with the given amount. Shorter and cleaner.
-=
+=
]]

-- Ill add more if I remember.

The code for the remote works, the client button doesn’t

Hm ok well thought I would point out some improvements anyway they could do just incase. To me it looks like they are unknowing of how to use pcall().

I did use pcall() for my datastore system, just forgot it existed for this one cause i have been banging my head for days at Roblox :slight_smile:

Show me the structure of the remotes in the replicated storage, your gui and whatever else is relevant to the issue. Or just upload the place file to allow me to edit it and I can re-upload it here.

Heres the place file
roblox being roblox.rbxl (481.1 KB)

1 Like

Fixed it. Give me a sec to save and upload. I will edit this post when able to upload.

roblox being roblox.rbxl (481.3 KB)

You wasnt getting the server to create the leaderstats folder and its children. I also removed that redundant while true loop. if you want to add it back then you may but i dont see it as being needed.

The while true loop was there to update the cash label as it was static but imma test rq

:ok_hand: :ok_hand: :ok_hand:


no voice to cry suffering