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

How do I get this message appear on one persons screen with a normal script?

I am making a admin script and when someone says "cmds/" I want a message (A Normal message you know the :"Instance.new("Message") kind) that only shows on the player's screen. This is the code I have right know.

if message:sub(1,5) == "cmds/" then
			local message = Instance.new("Message", workspace)
			message.Text = "Commands: btools | kick/ | msg/ | setmessage/ | remove/ | music/ | end/ | pause/ | resume/ | volume/ | reset/ | shutdown/"
			wait(5)
			message:Destroy()
		end

1 comment

2 answers

✓ Accepted answer
local plrs = game:GetService("Players"):GetChildren() --Get players

ChatEvent = function(sender) --sender is the person who sent the message
	sender.Chatted:Connect(function(msg) --msg is the msg itself (as a string)
		if string.lower(msg:sub(1,5)) == "cmds/" then
			local message = Instance.new("Message", sender:FindFirstChild("PlayerGui"))
			message.Text = "Commands: btools | kick/ | msg/ | setmessage/ | remove/ | music/ | end/ | pause/ | resume/ | volume/ | reset/ | shutdown/"
			wait(5)
			message:Destroy()
		end
	end)
end

for _,OldPlayer in pairs(plrs) do --you should keep this as you can then test in studio
	ChatEvent(OldPlayer)
end

game.Players.PlayerAdded:Connect(function(NewPlayer) --New player is the player that joined
	ChatEvent(NewPlayer)
end)

This would be a server script. It works, when I tested it. Hope this answers your question.

There are many tutorial channels related to this topic like AlvinBlox and other channels

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