Hello there! I'm currently having trouble with my morph into player script. The main handler throws an error: attempt to concatenate instance with string.
Here is the remote function code:
local remoteFunction = game.ReplicatedStorage:FindFirstChild("requestPlayerStatus")
local HttpProxy = require(game.ServerScriptService.HttpProxyService:Clone())
remoteFunction.OnServerInvoke = function(Id)
local data = game.HttpService:JSONEncode(HttpProxy:GetAsync("http://api.roblox.com/users/" .. Id .. "/onlinestatus"))
if not data.IsOnline then
return "offline"
end
if data.IsOnline then
return "online"
end
end
The GUI local script code:
local plrStatus = game.ReplicatedStorage.requestPlayerStatus:InvokeServer(script.Parent.Parent.Parent.UserId.Value)
if plrStatus == "offline" then
script.Parent.TextColor3 = Color3.fromRGB(85, 255, 0)
script.Parent.Text = "Online"
end
if not plrStatus == "offline" then
script.Parent.TextColor3 = Color3.fromRGB(255, 0, 0)
script.Parent.Text = "Offline"
end
I've looked through every devforum post mentioning this error. I apply the solution to my code unfortunately it does not change anything and still throws an error. I've tried everything I could possibly thing of. tostring() didn't work. tonumber() didn't work. I have absolutely no idea how to troubleshoot my code.
Any ideas?

3 comments
onserverinvoke returns the player as one of the arguments.
try id.Name
don't forget to accept the answer if it helped you.