local function SendRequest(Player, PlayerRequested)
print("[TEST]: " .. Player.Name .. " sent a trade request to " .. PlayerRequested .. "!")
end
game.ReplicatedStorage.Trade.RequestTradeToPlayer.OnServerInvoke = SendRequest
No, that part is correct because you attach a function to OnServerInvoke by just referencing the function. If you use SendRequest() instead of SendRequest, it just calls the function instead of assigning it to OnServerInvoke which will raise an error.
You need to return something in the server. InvokeServer/InvokeClient will yield the code until it gets a returned value
local function SendRequest(Player, PlayerRequested)
print("[TEST]: " .. Player.Name .. " sent a trade request to " .. PlayerRequested .. "!")
return true -- this value goes back to the client and will be specified as "Sending" as indexed in the code
end
game.ReplicatedStorage.Trade.RequestTradeToPlayer.OnServerInvoke = SendRequest
First of all, place print statements in your code for debugging till where the code is running. Also check if there are any errors in the output.
@RobloxTitan4223 It doesn’t need to be like that, the reason the OP has done it like that is because Remote Functions return a value which will need to be assigned to a variable. Again, its not a remote event, its a remote function.