Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why is this Event not working in an actual server?

I'm trying to make an announcement script that works with FE, but I'm stuck here. This is in a LocalScript. Any help here? I would greatly appreciate it.

Script below:

player = game:GetService("Players").LocalPlayer
guiyes = player:WaitForChild("PlayerGui")
replicate = game:GetService("ReplicatedStorage")

replicate.FEStuff.AnnoucementChange.OnClientEvent:Connect(function()
	guiyes.Annoucement.TextLabel.Text = game.Workspace.AnnoucementText.Value
end)

2 comments

0

-This works in normal Studio, but not with a FE server.

0

Event calling is this: http://prntscr.com/k6pa32

1 answer

✓ Accepted answer

You should replace lines 5-7 with:

replicate.FEStuff.AnnouncementChange.OnClientEvent:Connect(function(txt)
        guiyes.Announcement.TextLabel.Text = txt
end)

If you wanna fire the event, you'll have to use FireClient or FireAllClients in a server-sided(normal) script.

Here's how you could go about firing the event:

-- this is your code in a server-sided (normal) script

local replicated=game:GetService('ReplicatedStorage')
local event = replicated.FEStuff
local Text = 'idk xd' -- This will be your text that will be displayed in the announcement

-- You can fire the event to one player/client using:

event:FireClient(player, Text) -- player is an example of a player in a game

-- if you want to fire the event to all players/clients, use FireAllClients

event:FireAllClients(Text) -- FireAllClients doesn't need the player argument

This discussion is preserved as it was. New answers, comments, and votes are closed.