FireClient returning parameter with nil

So i’ve run into an error that I cannot explain to myself and didn’t find a solution for.
I’m trying to pass a proximity prompt from the server to the client through a remote event, but for some reason the client only receives nil as an argument. Heres the script:

		print(prompt) -- the prompt is being printed
		Remotes.EnablePrompt:FireClient(player, prompt)

Client:

Remotes.EnablePrompt.OnClientEvent:Connect(function(prompt)
	print("Event fired",prompt) -- prompt is being printed as nil
	if not prompt then return end -- code stops here
	prompt.Enabled = true
	print("Promp Enabled")
end)

whats the server script about? I only see the part where you send the player, maybe you aren’t referencing the player properly…?

and have you tried to put a wait before the print preferably a few seconds like 1 or 0.5?

Oh yeah,your client suppose to have (player, prompt)

Like this

–event.OnClientEvent:Connect(function(player,prompt )

See whether this works

If the player is not referenced properly in the server script, then the client script would never receive the signal and would print nothing at all, not even a nil

Client script doesnt receive the player as the first param, it only needs to be function(prompt)

maybe needs a wait on the server before sending the param and a wait before receiving the param on the client. (Also hi Peashie)

1 Like

Also there is a funny thing about this,client cannot get the server

Actually i dont why is there this bug when after the player varaible is sent,the other paarmeters wont work at all after

also I just realized, if this is a Prompt, you didn’t need to have a remote event to enable the Prompts from the server to the client (unless you needed the server to reference something as user owns gamepass or user is in this specific group rank).

you can just return true or false variables/param from the server since that’s much more easier for it to read instead of sending a stringValue (got me so complicated in doing stringValue params)

1 Like

I think thats the main issue, lack of context of OP’s script. I experienced little issues with passing instances from server to client in the past, but I just tested it, the prompt can be sent normally without any additional need.

I wanna guess that is something related with enable them from server for a specific, but yeah you have a point, perhaps @TTTDeathwish1 is not using the default functions of the ProximityPrompt.

Also Hi Nate!

1 Like

If prompt is an Instance then this is likely because the Prompt only exists on the server (ie: it’s parented to ServerStorage or ServerScriptService). You cannot replicate instances like this on Roblox.