The title says it all. I am using a combination of client-and server because I want to put the result into a GUI element eventually. However, even while using a proxy, it gives me this error: Mi_sst failed to fetch because Unable to fetchMi_sst is my username btw.
Important stuff:
Local script
local Event = Rep.HTTPEvent
local LocalPlayer = game:GetService("Players").LocalPlayer
local Info = Event:InvokeServer("https://users.roblox.com/v1/users/" .. LocalPlayer.UserId)
print(Info)
Server script
local Http = require(ReplicatedStorage.HttpProxyService)
ReplicatedStorage.HTTPEvent.OnServerInvoke = function(url)
local tbl = Http:GetAsync(url)
return tbl
end
OnServerInvoke (and OnServerEvent of RemoteEvents) automatically pass a player property as the first parameter, followed by any other parameters. You do not account for this in the server-sided code. Fixing this would be simply changing ReplicatedStorage.HTTPEvent.OnServerInvoke = function(url)
to ReplicatedStorage.HTTPEvent.OnServerInvoke = function(player,url)
Unrelated security practice: With your current setup, anybody can use Http with any website they’d like. You should either use the player parameter to limit who can use this event, or remove the ability for the client to determine the URL.
I need the client to determine the URL, because I need the UserId of the local player. But I can just pass the ID and have the actual url handled serverside.