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

Does anyone know the term for command activated functions?

Asked by 10 years ago

You know, like how with admin commands when you say something something else happens. Could someone please tell me what the term is?

2 answers

Log in to vote
0
Answered by 10 years ago
game.Players.Chatted:connect(function(msg)
if msg == "" then 
--whatever u want here
end)

game.Players.PlayerAdded:connect(msg) -- Hope it helped!
Ad
Log in to vote
0
Answered by 10 years ago

Hmm, this'll (maybe) explain how;

local Admins = {"Seaspirit89","Player1"} --Name of plaeyrs who can use the Admin

function Text(message,duration,parent,TextType) --For the 'm/' command
local m=Instance.new("Message")
m.Parent=parent
m.Text=message
wait(duration)
if m~=nil then
m:Destroy()
end
end

if game:FindService("Players")then --If game finds game.Players then
game:GetService("Players").PlayerAdded:Connect(function(plr) --Gets the service of Players, and starts the PlayerAdded event
for i,v in pairs(Admins)do --For loop for Admins
if plr.Name:lower()==v:lower() then --If name matches to Admins then
plr.Chatted:connect(function(msg) --Player can use commands

if msg:lower()=="test"then --If player chatted 'test' then
print("I'm printing a message!") --Prints a, well, print :P
end --The end

if msg:lower():sub(1,2)=="m/"then --If the msg starts with 'm/' then
Text(msg:sub(3),2,workspace,"Message") --Does a message (Type like 'm/string')
end --The end

end)
end
end
end)
end --The rest of the ends

I hope this helped!

Answer this question