HTTP Returning Invalid URL Type

I’m trying to use the OpenWeatherMap API in roblox but I keep getting “Invalid URL type, URL should be a string or secret.” on line 4 of my server script.

Local script:

script.Parent.MouseButton1Click:Connect(function()
	local baseUrl = "http://api.openweathermap.org/data/2.5/weather?"
	local apiKey = "<APIKEY>"
	local city = "London"
	
	local url = baseUrl.."appid="..apiKey.."&q="..city
	
	game.ReplicatedStorage.Events.ShareData:FireServer(url)
end)

Server script:

game.ReplicatedStorage.Events.ShareData.OnServerEvent:Connect(function(url)
	local httpService = game:GetService("HttpService")
	print(url)
	local response = httpService:GetAsync(url)
	print(response)
end)

The first argument in a remote event is the Player who fired it,

Your connected function params should be (Plr,url)

:slightly_smiling_face:

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.