#Making Announcement system but its not working

1 messages · Page 1 of 1 (latest)

signal epoch
#

I have 3 scripts and 3 models for this. so player uses IntercomController to input the message into Textbox and click submitbutton to send remoteevent to server. after that, intercomuicontroller shows screengui and intercomserver makes log of announcement & display them in MainScreen Frame3. Heres the whole scripts, structures of respective models.

#

<IntercomServer - Serverscript>
-- ServerScriptService.IntercomServer
local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")
local IntercomEvent = RS:WaitForChild("IntercomEvent")

local COOLDOWNS = {} -- {controllerName = lastUseTick}

#

-- 메인 로그 갱신
local function updateMainLog(locationText, messageText)
local screen = workspace:WaitForChild("OoIMainscreen").Screens.Center.SurfaceGui.Frame3.Frame.Center

-- 기존 로그 한 줄씩 위로 밀기 (5→2)
for i = 5, 2, -1 do
    local upper = screen:FindFirstChild((i-1).."stLine")
        or screen:FindFirstChild((i-1).."ndLine")
        or screen:FindFirstChild((i-1).."rdLine")
        or screen:FindFirstChild((i-1).."thLine")
    local lower = screen:FindFirstChild(i.."stLine")
        or screen:FindFirstChild(i.."ndLine")
        or screen:FindFirstChild(i.."rdLine")
        or screen:FindFirstChild(i.."thLine")
    if upper and lower then
        lower.Location.TextLabel.Text = upper.Location.TextLabel.Text
        lower.Message.TextLabel.Text = upper.Message.TextLabel.Text
        lower["Date/Time"].Date.TextLabel.Text = upper["Date/Time"].Date.TextLabel.Text
        lower["Date/Time"].Time.TextLabel.Text = upper["Date/Time"].Time.TextLabel.Text
    end
end

-- 새로운 메시지를 1stLine에 삽입
local first = screen:FindFirstChild("1stLine")
if first then
    first.Location.TextLabel.Text = locationText
    first.Message.TextLabel.Text = messageText
    first["Date/Time"].Date.TextLabel.Text = os.date("%y/%m/%d", os.time() + 9*3600)
    first["Date/Time"].Time.TextLabel.Text = os.date("%H:%M", os.time() + 9*3600)
end

end

-- 인터콤 이벤트 처리
IntercomEvent.OnServerEvent:Connect(function(player, controllerName, message)
if not controllerName or not message or message == "" then return end

local controller = workspace.IntercomController:FindFirstChild(controllerName)
if not controller then return end

local locationText = controller:FindFirstChild("LocationText") and controller.LocationText.Value or controllerName
#

-- 쿨다운 검사
COOLDOWNS[controllerName] = COOLDOWNS[controllerName] or 0
if tick() - COOLDOWNS[controllerName] < 60 then
IntercomEvent:FireClient(player, "COOLDOWN", controllerName)
return
end
COOLDOWNS[controllerName] = tick()

-- 메인 로그 업데이트
updateMainLog("ANNOUNCEMENT FROM "..locationText, message)

-- 모든 플레이어에게 SHOW 이벤트 전송
for _, plr in ipairs(Players:GetPlayers()) do
    IntercomEvent:FireClient(plr, "SHOW", {
        message = message,
        location = "ANNOUNCEMENT FROM "..locationText
    })
end

end)

#

<IntercomUIController Localscript -> Inside StarterPlayerScript>
-- StarterPlayerScripts.IntercomUIController
local TS = game:GetService("TweenService")
local RS = game:GetService("ReplicatedStorage")
local Players = game:GetService("Players")

local player = Players.LocalPlayer
local gui = player:WaitForChild("PlayerGui"):WaitForChild("IntercomGui")
local bg = gui:WaitForChild("Background")
local IntercomEvent = RS:WaitForChild("IntercomEvent")

local activeTween = nil
local activeTimer = nil

local START_Y = -0.25
local MOVE_Y = 0.15

local function show(data)
-- 기존 진행 중 UI 초기화
if activeTween then activeTween:Cancel() end
if activeTimer then task.cancel(activeTimer) end

bg.Intercom.Message.IntercomMessage.Text = data.message
bg.Intercom.Location.IntercomLocation.Text = data.location

bg.Position = UDim2.new(0, 0, START_Y, 0)

activeTween = TS:Create(bg, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
    Position = UDim2.new(0, 0, START_Y + MOVE_Y, 0)
})
activeTween:Play()

activeTimer = task.delay(8, function()
    local tweenUp = TS:Create(bg, TweenInfo.new(0.5, Enum.EasingStyle.Quad, Enum.EasingDirection.Out), {
        Position = UDim2.new(0, 0, START_Y, 0)
    })
    tweenUp:Play()
end)

end

-- 서버 SHOW 이벤트 수신
IntercomEvent.OnClientEvent:Connect(function(code, data)
if code == "SHOW" then
show(data)
end
end)

#

<IntercomControllerClient LocalScript -> Inside StarterPlayerScript>
-- StarterPlayerScripts.IntercomControllerClient
local RS = game:GetService("ReplicatedStorage")
local IntercomEvent = RS:WaitForChild("IntercomEvent")
local controllersFolder = workspace:WaitForChild("IntercomController")
local cooldownControllers = {} -- {controllerName = true/false}

-- 서버 COOLDOWN 이벤트 처리
IntercomEvent.OnClientEvent:Connect(function(code, arg)
if code == "COOLDOWN" then
local controller = controllersFolder:FindFirstChild(arg)
if not controller then return end
local gui = controller:WaitForChild("Screen").SurfaceGui
gui.Active = true
gui.Adornee = controller.Screen
local textbox = gui.Screen.Main.Textbox
textbox.PlaceholderText = "IN COOLDOWN"
cooldownControllers[arg] = true

    task.delay(60, function()
        if textbox then
            textbox.PlaceholderText = "Enter Announcement..."
            cooldownControllers[arg] = false
        end
    end)
end

end)

#

-- SubmitButton 클릭 처리
for _, controller in ipairs(controllersFolder:GetChildren()) do
local screenPart = controller:FindFirstChild("Screen")
if screenPart then
local gui = screenPart:FindFirstChild("SurfaceGui")
if gui then
gui.Active = true
gui.Adornee = screenPart
local main = gui:WaitForChild("Screen").Main
local submit = main:WaitForChild("Submit").SubmitButton
local textbox = main:WaitForChild("Textbox")

        submit.MouseButton1Click:Connect(function()
            local name = controller.Name
            if cooldownControllers[name] then
                textbox.PlaceholderText = "IN COOLDOWN"
                return
            end

            local msg = textbox.Text
            if msg == "" then return end
            textbox.Text = ""

            IntercomEvent:FireServer(name, msg)
        end)
    end
end

end

regal moon
#

have you tried asking the person who wrote this code for you?

signal epoch
odd peak
#

Idk what is some are Koreans?

dapper spear
#

its chatgpt thats why it isnt working

odd peak