Pro_JC
|
  |
| Joined: 08 Jul 2011 |
| Total Posts: 2701 |
|
|
| 24 May 2017 05:01 PM |
local Boat = script.Parent -- Creating a variable
Boat = Instance.new("Part"):WaitForChild()
Pineapples do not belong on Pizza |
|
|
| Report Abuse |
|
|
|
| 24 May 2017 05:02 PM |
| WaitForChild() requires a string as a parameter. |
|
|
| Report Abuse |
|
|
|
| 24 May 2017 05:03 PM |
| Even then it would return null since you're creating a new instance and not adding anything else to it. |
|
|
| Report Abuse |
|
|
Jaidenati
|
  |
| Joined: 10 Oct 2012 |
| Total Posts: 192 |
|
|
| 24 May 2017 05:05 PM |
Is the parent a model?
Try this:
local Boat
Boat = Instance.new("Part"):WaitForChild()
|
|
|
| Report Abuse |
|
|
| |
|
Jaidenati
|
  |
| Joined: 10 Oct 2012 |
| Total Posts: 192 |
|
|
| 24 May 2017 05:07 PM |
Haha oops. Wrong code.
local Boat = script.Parent -- Creating a variable
Boat = Instance.new("Part")
^ The above code should work.
|
|
|
| Report Abuse |
|
|
|
| 24 May 2017 05:08 PM |
why the hell are you using WaitForChild, the instance is DEFINITELY there. you don't need to WaitForChild.
|
|
|
| Report Abuse |
|
|
Pro_JC
|
  |
| Joined: 08 Jul 2011 |
| Total Posts: 2701 |
|
|
| 24 May 2017 05:08 PM |
local Boat = script.Parent
Boat = Instance.new("Part")
local Water = Boat:WaitForChild("Part")
-- Okay, I still have to look up what Parameter means. But I am just assuming that this is how I should do this.
Pineapples do not belong on Pizza |
|
|
| Report Abuse |
|
|
Pro_JC
|
  |
| Joined: 08 Jul 2011 |
| Total Posts: 2701 |
|
|
| 24 May 2017 05:09 PM |
I am having a lot of troubles. This is my 4th Week on learning Lua.
Pineapples do not belong on Pizza |
|
|
| Report Abuse |
|
|
|
| 24 May 2017 05:11 PM |
| What are you trying to do exactly? |
|
|
| Report Abuse |
|
|
Pro_JC
|
  |
| Joined: 08 Jul 2011 |
| Total Posts: 2701 |
|
|
| 24 May 2017 05:15 PM |
Well, my friend built this weird thing. Kinda looks like a boat. So I decided to play around with it by practicing my Lua skills. I wanted Water to appear at the bottom of the boat and then a While true do loop constantly play a rocking animation. It's simple. But the part of creating another part is the only problem I seem to be having.
Pineapples do not belong on Pizza |
|
|
| Report Abuse |
|
|
|
| 24 May 2017 05:19 PM |
You could have something like:
local Boat = script.Parent -- this is the boat
local water = Instance.new("Part",Boat) -- inserts a new brick into the boat
"water" is now the reference variable for the water brick. You can do things like "water.Transparency = .5" and such to modify the properties to where you need it. WaitForChild() was not needed here because you now have a direct reference to the part. |
|
|
| Report Abuse |
|
|