-
What do you want to achieve?
I want to have a function to when you click on a GUI button, it will actually sent a message in the chat. I have better uses for this then just that. -
What is the issue?
2 things to note here:
-1: when you join the game it sent’s a message already.
2:clicking on the button doesn’t do anything
-
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I have tried here and other places but, no-one was talking on how to do a click ChatMakeSystemMessage.
It shows no errors or anything like that as everything works fine, it’s just getting to to work properly is the issue. also not sure which script it could be likely that isn’t working properly so here’s 3 of them
=====================================
local TestEvent = game.ReplicatedStorage:WaitForChild("ClickedUI")
game.ReplicatedStorage.PlayerJoined.OnClientEvent:Connect(function(PlrName)
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = "[SYSTEM]: "..PlrName.." has joined the game",
Color = Color3.fromRGB(75, 151, 75),
Font = Enum.Font.FredokaOne,
TextSize = 18,
})
end)
game.ReplicatedStorage.PlayerLeft.OnClientEvent:Connect(function(PlrName)
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = "[SYSTEM]: "..PlrName.." has left the game",
Color = Color3.fromRGB(196, 40, 28),
Font = Enum.Font.FredokaOne,
TextSize = 18,
})
end)
TestEvent.OnClientEvent:Connect(function(PlrName)
game.StarterGui:SetCore("ChatMakeSystemMessage", {
Text = "[SYSTEM]: "..PlrName.." said hi to all of you :)",
Color = Color3.fromRGB(255, 255, 65),
Font = Enum.Font.FredokaOne,
TextSize = 18,
})
end)
=====================================
local RS = game.ReplicatedStorage:WaitForChild("ClickedUI")
game.Players.PlayerAdded:Connect(function(Player)
game.ReplicatedStorage.PlayerJoined:FireAllClients(Player.Name)
end)
game.Players.PlayerRemoving:Connect(function(Player)
game.ReplicatedStorage.PlayerLeft:FireAllClients(Player.Name)
end)
game.Players.PlayerAdded:Connect(function(Player)
RS:FireAllClients(Player.Name)
end)
=====================================
local RS = game.ReplicatedStorage:WaitForChild("ClickedUI")
local function Clicked(Player)
RS.OnClientEvent:Connect(Player)
end
script.Parent.MouseButton1Click:Connect(Clicked)
=====================================
do not write entire scripts or design entire systems.