Server to client remote event

So I made a gamepass and I want to run a remote event from the server to the client. But it doesnt run the code on the client. Any help is very appreciated!

MPS.PromptGamePassPurchaseFinished:Connect(function(player, purchasepassId, purchaseSuccess)
	if purchaseSuccess == true and purchasepassId == gamepassID then
		warn("firing server")
	client:FireClient(player, purchaseSuccess)
--works fine
client.OnClientEvent:Connect(function(player, purchasesuccess)
	warn("passed client")
	passowner = purchasesuccess
--doesn't work

In the client script, when it’s called, the first argument which is passed from server to a specified client isn’t the player; so the ‘purchasesuccess’ value you attempted to pass is ‘nil’, because the player object isn’t passed from server-to-client. Hope I’ve been clear. <3

So in this case, it would be:

	warn("passed client")
	passowner = purchasesuccess

I suggest you to pass around additional info there, if you’re still new into using server to client and viceversa communications. Happy coding!

Thanks for the help! But that doesn’t seem to be the problem. For some reason the OnClientEvent function isn’t running. Would love to hear from you again!

You need to put these i believe:
like decrypteds said:

well i think it helped you

1 Like