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

Commands using text works?

Say if I wanted to make another khols admin commands, to do that. Would I use Text?

Example below:

if text == "hi" then
game.Workspace.Player:GetPlayers("Humanoid")
Players.Humanoid.Health = 0
end

If it is true, how'd I define it. If it needs defining?

2 comments

0

What?

0

Sorry I'll edit it

1 answer

✓ Accepted answer
local admins = {"Roboy5857"}

isNotAdmin = function(name)
	local notAdmin = true
	for _,v in pairs(admins) do
		if v == name then
			notAdmin = false
		end
	end
	return notAdmin
end

game.Players.PlayerAdded:connect(function(plr)
	if isNotAdmin(plr.Name) then return end

	plr.Chatted:connect(function(msg)
		if msg.Text == "hi" then
			print(plr.Name.." used the 'hi' command!")
		end
	end)
end)

This should get you onto the right track for commands.

The .Chatted event is fired whenever a player talks

2 comments

0

Thanks

0

No problem

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