DataStore2 FireClient arguments return nil

I attempted to use code from DataStore2’s api page for updating GUI.

The code is as follows for the server script:

local coinstore = ds2("Coins",plr)
		
local function coinremote(value)
	rs.updateGui:FireClient(plr,value)
end

print(coinstore:Get(5000))		
coinremote(coinstore:Get(5000))
		
coinstore:OnUpdate(coinremote())

and inside a localscript for said GUI, the code is:

local function update(plr,value)
	task.wait(5)
	print(plr)
	print(value)
	script.Parent.Text = value
end

update.OnClientEvent = update()

The print in the server script returns as 5000, however the localscript’s prints returns nil for both arguments.
I have no clue why this is happening when this is in official documentation for DataStore2. Is this a known issue or have I missed something?

try replacing that with

coinstore:OnUpdate(coinremote)

May not resolve the issue, but it is certainly an issue that should be resolved

Unfortunately didn’t solve the issue. The argument is still nil.

Create an RBXScriptConnection using Connect(). You must have confused RemoteEvent with RemoteFunction.

update.OnClientEvent:Connect(update)

that was absolutely it, ive been using remotefunctions for a bit and absolutely confused the two. thank you both for helping out!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.