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: .Parent or .Workspace?

Previous Thread :: Next Thread 
SkyNight56 is not online. SkyNight56
Joined: 06 Sep 2009
Total Posts: 191
21 Jan 2014 05:37 PM
I am trying to whip up another script, and I came across an problem... should it be script.Parent.Workspace... or script.Workspace? the script itself is in Workspace so im in a bit of confusion...the script also seems to not work, am I not doing something right here?

Word = "start"

flap = script.Workspace.Pads:GetChildren()

game.Players.PlayerAdded:connect(function(player)
Players.Chatted:connect(function(msg)
if (msg == Word) then

while true do
wait()
for i = 1, #flap do
if (flap[i].className == "Part") then
flap[i].CFrame = flap[i].CFrame + Vector3.new(0.1,0,0)
end
end

end
end
end)
end)
Report Abuse
ElectricAxel is not online. ElectricAxel
Joined: 15 May 2009
Total Posts: 16239
21 Jan 2014 05:38 PM
workspace alone:

workspace.Pads:children()
Report Abuse
SkyNight56 is not online. SkyNight56
Joined: 06 Sep 2009
Total Posts: 191
21 Jan 2014 05:40 PM
ah, thnx again lol
Report Abuse
duckwit is not online. duckwit
Joined: 08 Aug 2008
Total Posts: 1310
21 Jan 2014 05:40 PM
You don't seem to understand the hierarchy of the roblox file tree.

At the top of everything is game, or Game.
Under game are all the services, which are Workspace, Lighting, ReplicatedStorage, Teams, etc...

Inside a script, you can refer to workspace as game.Workspace or just workspace.

Dot notation is used to follow a path of objects: script.Workspace makes no sense, because Workspace is not a child (descendent) of script.

If the script is in the workspace, then you can use "script.Parent" to refer to the workspace, or you can just use game.Workspace, or workspace, as mentioned above.

Let me know if you have any further questions.
Report Abuse
SkyNight56 is not online. SkyNight56
Joined: 06 Sep 2009
Total Posts: 191
21 Jan 2014 05:43 PM
i do get it, but im not that knowledgable for scripting yet... thats why im going to college for it next year, so i can learn even more of the properties and the ins/outs of it since the ROBLOX wiki doesnt really do it well
Report Abuse
duckwit is not online. duckwit
Joined: 08 Aug 2008
Total Posts: 1310
21 Jan 2014 05:45 PM
I started learning a month or so ago, the Roblox Wiki tells me practically everything about scripting in Roblox. Give it some time and patience, it'll begin to sink in.
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