Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Commands using text works?

Asked by 10 years ago

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?

0
What? Articulating 1335 — 10y
0
Sorry I'll edit it Roboy5857 20 — 10y

1 answer

Log in to vote
0
Answered by 10 years ago
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

0
Thanks Roboy5857 20 — 10y
0
No problem VariadicFunction 335 — 10y
Ad

Answer this question