Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Why is this Event not working in an actual server?

Asked by 6 years ago

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)

0
-This works in normal Studio, but not with a FE server. TheBlackDeveloper 0 — 6y
0
Event calling is this: http://prntscr.com/k6pa32 TheBlackDeveloper 0 — 6y

1 answer

Log in to vote
0
Answered by
Rare_tendo 3000 Moderation Voter Community Moderator
6 years ago
Edited 6 years ago

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

Ad

Answer this question