All pastes #686690 Raw Edit

Messages Script

public lua v1 · immutable
#686690 ·published 2007-09-08 02:54 UTC
rendered paste body
-- Anaminusprint("Chat: Messages")permission = {"Anaminus"}function check(name)	if table.maxn(permission) == 0 then print("No admins") return true end --Remove all names from permission to allow all players to use command.	for i = 1,#permission do		if (string.upper(name) == string.upper(permission[i].Name)) then return true end	end	return falseendfunction DebugMessages()	local workspace = game.Workspace:GetChildren()	for i = 1,#workspace do		if workspace[i].className == "Message" or workspace[i].className == "Hint" then			workspace[i].Parent = nil		end	end	local player = game.Players:GetChildren()	for i = 1,#player do		local child = player[i]:GetChildren()		for p = 1,#child do			if child[p].className == "Message" or child[p].className == "Hint" then				child[p].Parent = nil			end		end	endendfunction DisplayMessage(text, Wait, parent)	local message = Instance.new("Message")	message.Text = text	message.Name = "Message"	message.Parent = parent	wait(Wait)	message.Parent = nilendfunction DisplayHint(text, parent)	local hint = parent:FindFirstChild("Hint")	if hint == nil then		hint = Instance.new("Hint")		hint.Name = "Hint"		hint.Parent = parent	end	hint.Text = textendfunction RemoveHint(parent)	local hint = parent:FindFirstChild("Hint")	if hint ~= nil then		hint.Parent = nil	endendfunction onChatted(msg, recipient, speaker)	-- convert to all lower case	local source = string.lower(speaker.Name)	msg = string.lower(msg)	-- Below is only for Admins	if not check(source) then return end		if string.sub(norm,1,3)=="/m " then --Create a game message		DisplayMessage(string.sub(norm,4),5, game.Workspace)	end	if string.sub(norm,1,3)=="/h " then --Create a game hint		DisplayHint(string.sub(norm,4), game.Workspace)	end	if string.sub(norm,1,3)=="/rh" then --Remove a game hint		RemoveHint(game.Workspace)	end	if string.sub(norm,1,3)=="/dm" then --Debugs all messages and hints in players and workspace		DebugMessages()	endendfunction onPlayerEntered(newPlayer)	newPlayer.Chatted:connect(function(msg, recipient) onChatted(msg, recipient, newPlayer) end) endgame.Players.ChildAdded:connect(onPlayerEntered)