Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Why won't the text show in chat once I've press a button?

Here is the code.

script.Parent.Parent.MouseButton1Click:Connect(function()
	game.StarterGui:SetCore("ChatMakeSystemMessage", {
	Text = "Chase in progress, 10-0.";
	Font = Enum.Font.SourceSansBold;
	FontSize = Enum.FontSize.Size96;	
})
end)

The code above is in a local script in a button.

Could someone help me out please. Thank you!

1 comment

0

2nd edit

1 answer

✓ Accepted answer

LocalScript

script.Parent.Parent.Activated:Connect(function()
	game.StarterGui:SetCore("ChatMakeSystemMessage", {
	Text = "Chase in progress, 10-0.";
	Font = Enum.Font.SourceSansBold;
	FontSize = Enum.FontSize.Size96;    
	})
end)

Your code is perfectly fine, though I suggest using Activated instead of MouseButton1Click since Activated works for all devices, not just computers

Reason why it may not be working:

When you choose "Play Solo" in studio, the chat doesn't always load correctly

If you test in a local server, where the chat does work, you will see the message appear

Make sure that script.Parent.Parent is a Text / Image Button

EDIT, according to your question, it appears that the script's Parent is the button, so you need to remove a parent:

script.Parent.Activated:Connect(function()
	game.StarterGui:SetCore("ChatMakeSystemMessage", {
	Text = "Chase in progress, 10-0.";
	Font = Enum.Font.SourceSansBold;
	FontSize = Enum.FontSize.Size96;    
	})
end)

EDIT2, In order to get the player name in the chat, the first argument is the message string, so you can say

local player = game.Players.LocalPlayer

script.Parent.Activated:Connect(function()
	game.StarterGui:SetCore("ChatMakeSystemMessage", {
	Text = (player.Name..": Chase in progress, 10-0.");
	Font = Enum.Font.SourceSansBold;
	FontSize = Enum.FontSize.Size96;    
	})
end)

2 comments

0

Thank you!

0

Where would I put the player name so it shows on chat the player name and then Chase in progress, 10-0.

This discussion is preserved as it was. New answers, comments, and votes are closed.