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

Why isnt this sending a server message?

Asked by
CDXKIE 130
3 years ago

So, i made this script based off an AlvinBlox tutorial. It's supposed to send a server message in the chat.

The only error is "StarterGui:SetCore must be fired from a localscript", but i done that an got the same error (the localscript was in startergui btw)

Here is the code:

game.Players.PlayerAdded:Connect(function(player)
    game.StarterGui:SetCore("ChatMakeSystemMessage", {
        Text = player.Name.. " just joined the game!";
        Font = Enum.Font.Cartoon;
        Color = Color3.new(0.228031, 1, 0.0260929);
        FontSize = Enum.FontSize.Size96
    })
end)

Could someone help me out?

1 answer

Log in to vote
0
Answered by 3 years ago

try doing this in a script in serverscriptservice

game.Players.PlayerAdded:Connect(function(player)
    game.ReplicatedStorage.NotifyJoin:FireAllClients(player) -- make remote event in replicated storage and fire
end)

local script in starter player scripts

game.ReplicatedStorage.NotifyJoin.OnClientEvent:Connect(function(player)
    game.StarterGui:SetCore("ChatMakeSystemMessage", {
        Text = player.Name.. " just joined the game!";
        Font = Enum.Font.Cartoon;
        Color = Color3.new(0.228031, 1, 0.0260929);
        FontSize = Enum.FontSize.Size96
    })
end)
0
Thanks a ton! CDXKIE 130 — 3y
Ad

Answer this question