You know, like how with admin commands when you say something something else happens. Could someone please tell me what the term is?
COMMUNITY QUESTION
Does anyone know the term for command activated functions?
2 answers
game.Players.Chatted:connect(function(msg)
if msg == "" then
--whatever u want here
end)
game.Players.PlayerAdded:connect(msg) -- Hope it helped!
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!
This discussion is preserved as it was. New answers, comments, and votes are closed.
