Why I cant use set local with RemoteEvents

I trying this:

local Device = game:GetService("ReplicatedStorage").RemoteEvent:FireClient(player, what)
print(Device) -- prints only nil

	if what == "1" then
		return "Character"
	elseif what == "2" then
		return "Player"
	return "HAYHAY"

just focus on codes.

The code on the variable is firing, not really declaring. You should try to check if the remote event actually exists in place first on client.

You can either use two or the same remote event where the client fires it and allowing the server to use OnServerEvent as an option, or simply the below.

if you want to return something to the server from a specific client, you have to use RemoteFunctions

More info

Never use InvokeClient, since exploiters can make the entire server hang.


then what should i do?

and why do we use it in roblox studio if there is no security at all?

You can use a yielding time limit. If the timer runs out, you can just use return nil. This will prevent exploiters from blocking out the server forever.