Trying to make a request from a website to show on all clients text label

Hello, I’m trying to make a system that will get a text from a JSON and enter it into a text label, I’ve been using a remote event to fire on all clients. Here is the script:

Server:


local Remote = game.ReplicatedStorage.RemoteEvent
local HttpService = game:GetService("HttpService")

local URL_MESSAGE = "****/messageIt.json"

local response = HttpService:GetAsync(URL_MESSAGE)

local data = HttpService:JSONDecode(response)

print(data.message)
wait(3)

Remote:FireClient(data)

Local:

local Frame = script.Parent.Frame
local Label = Frame.TextLabel

local Remote = game.ReplicatedStorage.RemoteEvent


Remote.OnClientEvent:Connect(function(data)
	
	print("Executing")
	Label.Text = data.message
	
end)

The first parameter of the FireClient function has to be a Player object :sweat_smile:

What I mean by that, is whenever a Player joins the game, a Player object gets added into the Players service (Or game.Players.LOGIC1EXE)

Instead, you can do FireAllClients and pass your data that way to all clients

1 Like

Thank you! my brain is not working at this hours :slight_smile: !

1 Like

But still. same error:

Unable to cast value to Object

What is data.message defined as? I don’t think I know much about HTTPService but I’ll try my best :thinking:

It’s getting me a JSON value, the data is:

{
 message: "yes"
}

And data.message is:

yes

Server:

local Remote = game.ReplicatedStorage.RemoteEvent
local HttpService = game:GetService("HttpService")

local URL_MESSAGE = "****/messageIt.json"

local response = HttpService:GetAsync(URL_MESSAGE)

local data = HttpService:JSONDecode(response)

print(data.message)
wait(3)

Remote:FireClient(data.message)

Local:

local Frame = script.Parent.Frame
local Label = Frame.TextLabel

local Remote = game.ReplicatedStorage.RemoteEvent


Remote.OnClientEvent:Connect(function(data)
	
	print("Executing")
	Label.Text = data
	
end)

Maybe try this

It’s FireAllClients

local Frame = script.Parent.Frame
local Label = Frame.TextLabel

local Remote = game.ReplicatedStorage.RemoteEvent


Remote.OnClientEvent:Connect(function(data)
	print(data)
    print(data.message)
	print("Executing")
	Label.Text = data
	
end)

Try this inside the Local side