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: I'm going to sound stupid asking this but-

Previous Thread :: Next Thread 
jojobenten is not online. jojobenten
Joined: 27 Jan 2009
Total Posts: 8819
13 Sep 2013 03:56 PM
How do you find an object that has a space in it?

Example:

game.Workspace.Player.Left Arm:Destroy()

It won't find 'Left Arm'..
I used to know this but my absence from Roblox has sort of erased part of my scripting knowledge.
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
13 Sep 2013 03:56 PM
Brackets.

Workspace.Player['Left Arm']:Destroy()
Report Abuse
jojobenten is not online. jojobenten
Joined: 27 Jan 2009
Total Posts: 8819
13 Sep 2013 03:57 PM
@Ab

Ohh-

I was doing ["Left Arm"]..
Thanks!
Report Abuse
jojobenten is not online. jojobenten
Joined: 27 Jan 2009
Total Posts: 8819
13 Sep 2013 03:58 PM
The line still has a red bar underneath it though..
Report Abuse
As8D is not online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
13 Sep 2013 03:59 PM
It doesn't matter whatever you use ' or ". The problem must've been something else, jojo.

- As, Well, it only matters if you have quotes inside a string. Or something like that. [[Helooh]]
Report Abuse
jojobenten is not online. jojobenten
Joined: 27 Jan 2009
Total Posts: 8819
13 Sep 2013 04:00 PM
Hmm.

game.Workspace.MangoStudio.['Right Arm'].Color = BrickColor.new("Black")

It is underlining this red.
:(
Report Abuse
thekilleryo22 is not online. thekilleryo22
Joined: 24 Mar 2013
Total Posts: 226
13 Sep 2013 04:01 PM
Local player = game.Players.LocalPlayer
LeftArm = player.Character.["Left Arm"]
game.Workspace.Player.LeftArm:Destroy()
Report Abuse
jojobenten is not online. jojobenten
Joined: 27 Jan 2009
Total Posts: 8819
13 Sep 2013 04:02 PM
@thekiller

It still underlines it red.
Report Abuse
thekilleryo22 is not online. thekilleryo22
Joined: 24 Mar 2013
Total Posts: 226
13 Sep 2013 04:03 PM
Make a function.
Report Abuse
jojobenten is not online. jojobenten
Joined: 27 Jan 2009
Total Posts: 8819
13 Sep 2013 04:05 PM
The output states-

Workspace.Script:43: name expected near [
Report Abuse
As8D is not online. As8D
Joined: 24 Dec 2009
Total Posts: 2907
13 Sep 2013 04:08 PM
The problem is your .

Look, when using brackets, dots are only found AFTER the brackets... amazingly enough.


workspace["Name"] = "Hello" -- will change the name of Workspace to Hello.

workspace["Part"].BrickColor = BrickColor.new("White") -- Will change the brickcolor of Part to White.

Also, you can do the same stuff with tables as with instances. Those tables are called dictionaries.


local tab = {a = 1, b = 2, [workspace] = 3, ["c"] = 4}

print(tab.a) > 1
print(tab["b"]) > 2
print(tab.c) > 4
print(tab[workspace]) > 3
-- Note that at step 4, the brackets are required, because our key is an instance, not a string.


- As, NOW, METATABLES DEWD!
Report Abuse
Absurdism is not online. Absurdism
Joined: 18 Jul 2013
Total Posts: 2568
13 Sep 2013 04:08 PM
Details are important. I didn't put a period before the brackets.
Also, the syntax of the quotes don't matter. It could be denominated as "", '', [[]]. [==[]==], so on.

game.Workspace.MangoStudio['Right Arm'].Color = BrickColor.new("Black")
Report Abuse
jojobenten is not online. jojobenten
Joined: 27 Jan 2009
Total Posts: 8819
13 Sep 2013 04:09 PM
@as

Wow I didn't know that!
Thanks a lot. :D
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