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

Welcome script not connecting and or won't display in chat, how to fix?

Asked by 5 years ago

I've put the script in a local script since StarterGui:SetCore must be called from a local script and I've also put it in the StarterGui but it still doesn't work. I know the MakeChat function works, but when I add the function that connects it to a player joining it stops and doesn't print the text in chat.

function MakeChat(Msg,Color) Color=Color or Color3.new(0,1,0) game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{ Text = Msg; Color = Color; Font = Enum.Font.SourceSansBold; FontSize = Enum.FontSize.Size18; }) end function onPlayerEntered(nP) MakeChat("[SERVER]: Welcome, "..nP.Name.."!", Color3.new(12,130,22)); end game.Players.PlayerAdded:connect(onPlayerEntered) Any clue on how to fix?

0
have you tried using a variable for the msg or simple test text? Could be the way its formatted. Is it giving an error? doncellanerdy 21 — 5y
0
no error, nothing in output or anything WXWWWWWWWWQWWWWWWWWW 2 — 5y

1 answer

Log in to vote
0
Answered by 5 years ago
Edited 5 years ago

You could use a RemoteEvent to communicate between the server and client, which allows for you to manipulate the StarterGui from the server.

Server script:

local ReplicatedStorage = game:GetService("ReplicatedStorage")

local Event = ReplicatedStorage:WaitForChild("RemoteEvent")

function onPlayerEntered(nP)
    Event:FireClient(nP,"[SERVER]: Welcome, "..nP.Name.."!", Color3.new(12,130,22))
end
game.Players.PlayerAdded:connect(onPlayerEntered)

LocalScript:

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local Event = ReplicatedStorage:WaitForChild("RemoteEvent")

Event.OnClientEvent:Connect(function(msg,color)
    game:GetService("StarterGui"):SetCore("ChatMakeSystemMessage",{
        Text = msg;
        Color = color or Color3.new(0,1,0);
        Font = Enum.Font.SourceSansBold;
        FontSize = Enum.FontSize.Size18;
    })
end)
Ad

Answer this question