Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Jul 2014 04:53 AM |
Hello, I want to make a script that will give me a hat when I say the name of it. I only want the start that only I can say it. Like an admin.
Could someone make that for me? I'm not too good at scripting qq |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 04:55 AM |
| http://wiki.roblox.com/index.php?title=Chatted_%28Event%29 |
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Jul 2014 04:58 AM |
| I don't understand that.. Sorry |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 05:02 AM |
Alright, an example would be game.Players.PlayerAdded:connect(function(Player) --This is what is triggered when the actual "Player" joins the game. Player.Chatted:connect(function(Message) --This is what is triggered when the actual "Player" begins chatting a "Message", the "Message" is anything that the "Player" chats. end) end) |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 05:04 AM |
I would suggest looking at tutorials area of the "Roblox Wiki" to help you improve your scripting skills, http://wiki.roblox.com/index.php?title=AllTutorials
If you're interested, I can explain this more thoroughly to you in-game if you want. |
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Jul 2014 05:08 AM |
| I know that part. But I want only me to be able to have the "admin command". |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 05:11 AM |
Alright, Player.Chatted:connect(function(Message) if Player.Name == "fatalizer" then --Code Here end end)
|
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Jul 2014 05:12 AM |
Thanks, really thanks. I'll try and remember the sentence everytime I make a script like this. :) Thanks for the support ! |
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Jul 2014 05:15 AM |
I want the command to clone a Hat, the Hat's in roblox can't be cloned right?
Then how will I let a person wear a hat with :Clone() ? |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 05:15 AM |
Also, you'll want to have something such as, if Message == "MessageHere" then --Code Here end so that the event won't trigger everytime someone chats. |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 05:17 AM |
Just use something such as, Hat = Instance.new("Hat") HatHandle = Instance.new("Part",Hat) HatHandle.Name = "Handle" and from there just add a mesh. |
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Jul 2014 05:19 AM |
Ah . I will do that. This sounds completely stupid and probally isn't right isn't it?;
Player.Chatted:connect(function(Message) if Player.Name == "Fatalizer" then
end
if Message == "/remove/bp" then game.Workspace.BasePlate:Remove() end end) |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 05:21 AM |
I'll give you another example, Hat = Instance.new("Hat") HatHandle = Instance.new("Part", Hat) HatHandle.Name = "Handle" game.Players.PlayerAdded:connect(function(Player) Player.Chatted:connect(function(Message) if Player.Name == "Fatalizer" and Message == "MessageHere" then --More Code Here end end) end) |
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Jul 2014 05:28 AM |
So it will be this;
Player.Chatted:connect(function(Message) if Player.Name == "Fatalizer" then
end
if Message == "Mask" then SadMask = Instance.new("Hat", LocalPlayer) SadMaskHandle = Instance.new("Part", SadMask) SadMaskHandle.Name = "Handle" Mesh = Instance.new("Mesh", SadMask.SadMaskHandle) SadMask.SadMaskHandle.Mesh.MeshId = "http://www.roblox.com/asset/?id=13520910" SadMask.SadMaskHandle.MeshType = "FileMesh" SadMask.SadMaskHandle.Scale = vector3.new(1,1,1) SadMask.SadMaskHandle.TextureId = "http://www.roblox.com/asset/?id=13520915" SadMask.SadMaskHandle.VertexColor = Vector3.new(100000,100000,100000) end end)
? |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 05:30 AM |
| You can't add the end between because "Message" is the function's "parameter" or "argument", otherwise it seems like it will work, assuming you've defined "Player". |
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
| |
|
|
| 10 Jul 2014 05:34 AM |
game.Players.PlayerAdded:connect(function(Player) Player.Chatted:connect(function(Message) if Player.Name == "Fatalizer" then if Message == "Mask" then SadMask = Instance.new("Hat", Player.Character) SadMaskHandle = Instance.new("Part", SadMask) SadMaskHandle.Name = "Handle" Mesh = Instance.new("Mesh", SadMask.SadMaskHandle) SadMask.SadMaskHandle.Mesh.MeshId = "http://www.roblox.com/asset/?id=13520910" SadMask.SadMaskHandle.MeshType = "FileMesh" SadMask.SadMaskHandle.Scale = vector3.new(1,1,1) SadMask.SadMaskHandle.TextureId = "http://www.roblox.com/asset/?id=13520915" SadMask.SadMaskHandle.VertexColor = Vector3.new(100000,100000,100000) end end end) end) Here you go, also, "LocalPlayer" is only meant to be used in a "LocalScript", here's a link to help you, http://wiki.roblox.com/index.php?title=RBX.lua.LocalScript_%28Object%29 you also needed to define player, since there's multiple methods of doing this, I'll also link you to an article on loops, http://wiki.roblox.com/index.php?title=Loops Otherwise, excellent work. |
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Jul 2014 05:36 AM |
| Thanks for the help. Really helpfull :) |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 05:36 AM |
| The script will also error, because one of the lines where you used "Vector3.new()" wasn't properly capitalized. |
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Jul 2014 05:38 AM |
If I want to add in more like, commands do I just add this;
game.Players.PlayerAdded:connect(function(Player) Player.Chatted:connect(function(Message) if Player.Name == "Fatalizer" then if Message == "Mask" then SadMask = Instance.new("Hat", Player.Character) SadMaskHandle = Instance.new("Part", SadMask) SadMaskHandle.Name = "Handle" Mesh = Instance.new("Mesh", SadMask.SadMaskHandle) SadMask.SadMaskHandle.Mesh.MeshId = "http://www.roblox.com/asset/?id=13520910" SadMask.SadMaskHandle.MeshType = "FileMesh" SadMask.SadMaskHandle.Scale = vector3.new(1,1,1) SadMask.SadMaskHandle.TextureId = "http://www.roblox.com/asset/?id=13520915" SadMask.SadMaskHandle.VertexColor = Vector3.new(100000,100000,100000) end end end) end)
if Message == "/kill/me" then game.Workspace.Player.Character:Breakjoint() end
Is that good? |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 05:40 AM |
"Message" is limited to the scope of the function it was created in this case, think of the parameter as similar to using a local variable.
|
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Jul 2014 05:41 AM |
| Then how should I make it work out if I want more commands? |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 05:42 AM |
Well, you could create a "Table", http://wiki.roblox.com/index.php?title=Table Store the strings and then loop through it. |
|
|
| Report Abuse |
|
|
Fatalizer
|
  |
| Joined: 28 Aug 2011 |
| Total Posts: 1520 |
|
|
| 10 Jul 2014 05:43 AM |
| Pff.. The script that you holp me with before just spawn a Part in the Workspace. |
|
|
| Report Abuse |
|
|
|
| 10 Jul 2014 05:45 AM |
| Did you position it?. Or try to pick the "Hat" up?. |
|
|
| Report Abuse |
|
|