generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripting Helpers
Home Search
 

Re: Script help

Previous Thread :: Next Thread 
Fatalizer is not online. 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
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
10 Jul 2014 04:55 AM
http://wiki.roblox.com/index.php?title=Chatted_%28Event%29
Report Abuse
Fatalizer is not online. Fatalizer
Joined: 28 Aug 2011
Total Posts: 1520
10 Jul 2014 04:58 AM
I don't understand that.. Sorry
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
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
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
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 is not online. 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
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
10 Jul 2014 05:11 AM
Alright,
Player.Chatted:connect(function(Message)
if Player.Name == "fatalizer" then
--Code Here
end
end)
Report Abuse
Fatalizer is not online. 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 is not online. 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
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
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
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
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 is not online. 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
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
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 is not online. 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
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
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 is not online. Fatalizer
Joined: 28 Aug 2011
Total Posts: 1520
10 Jul 2014 05:31 AM
Could you make the fix?
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
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 is not online. Fatalizer
Joined: 28 Aug 2011
Total Posts: 1520
10 Jul 2014 05:36 AM
Thanks for the help. Really helpfull :)
Report Abuse
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
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 is not online. 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
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
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 is not online. 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
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
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 is not online. 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
AnonyAnonymous is not online. AnonyAnonymous
Joined: 23 Jun 2013
Total Posts: 6332
10 Jul 2014 05:45 AM
Did you position it?. Or try to pick the "Hat" up?.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image