Why won't the remote event work?

I am making it so if a snow storm happens, it fires an event which changes a gui’s text. But it isn’t working with no errors.
Script for snowstorm.

local SnowStormEvent = game.ReplicatedStorage.SnowStormEvent
function SnowStorm()
	game.Lighting.FogStart = 0
	game.Lighting.FogEnd = 100
	game.Lighting.ExposureCompensation = -2
	print("Snow storm begins")
	SnowStormEvent:FireAllClients()
end
function SnowStormEnd()
	game.Lighting.FogStart = 500
	game.Lighting.FogEnd = 1500
	game.Lighting.ExposureCompensation = 0
	print("Snow storm ends")
end
while true do
	wait(16)
	SnowStorm()
	wait(45)
	SnowStormEnd()
end

script for gui event

local TextGui = script.Parent
local Text = TextGui.TextLabel
local SnowStormEvent = game.ReplicatedStorage.SnowStormEvent
function ChangeText()
	TextGui.Visible = true
	Text = "Snow storm has been spotted!"
	wait(3)
	TextGui.Visible = false
end
SnowStormEvent.OnServerEvent:Connect(ChangeText)

In the gui change

SnowStormEvent.OnServerEvent:Connect(ChangeText)
--To
SnowStormEvent.OnClientEvent:Connect(ChangeText)
3 Likes

Also change this:

local SnowStormEvent = game.ReplicatedStorage.SnowStormEvent

to this:

local SnowStormEvent = game.ReplicatedStorage:WaitForChild("SnowStormEvent")

error: 20:42:49.807 - OnClientEvent can only be used on the client

In the server event script,

You’re changing the Variable, not the TextLabel’s Text.

Try:

Text.Text = -- text here

Instead of:

Text = -- text here

And In your local script, say :FireServer() instead of FireAllClients()

1 Like

Oh, I was using a script not a local script.

To read.