thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 03 Aug 2013 06:21 AM |
function ontouched() rand = math.random(1,3) if rand == 1 then game.Lighting.Dark:clone() clone.Parent = Workspace clone.Posistion = Workspace.Baseplate.Position.Vector3.new(0, 5, 0) end end
function ontouched() rand = math.random(1,3) if rand == 2 then game.Lighting.Light:clone() clone.Parent = Workspace clone.Posistion = Workspace.Baseplate.Position.Vector3.new(0, 5, 0) end end
function ontouched() rand = math.random(1,3) if rand == 3 then game.Lighting.Medium:clone() clone.Parent = Workspace clone.Posistion = Workspace.Baseplate.Position.Vector3.new(0, 5, 0) wait() end end
script.Parent.Part.Touched:connect(ontouched) |
|
|
| Report Abuse |
|
|
thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
| |
|
thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
| |
|
Epic1230
|
  |
| Joined: 07 Dec 2011 |
| Total Posts: 289 |
|
|
| 03 Aug 2013 06:40 AM |
| clone* isn't a model or a variable. You said clone.Parent.. And clone.Position. |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 06:55 AM |
Instead of: game.Lighting.Light:clone() clone.Parent = Workspace Do this TheClone = game.Lighting.Light:Clone() TheClone.Parent = game.Workspace |
|
|
| Report Abuse |
|
|
thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 03 Aug 2013 06:58 AM |
Yeah I knew that but this doesn't work:
function ontouched() rand = math.random(1,3) if rand == 1 then game.Lighting.Dark:clone() Dark.Parent = Workspace Dark.Posistion = Workspace.Baseplate.Position.Vector3.new(0, 5, 0) end end
function ontouched() rand = math.random(1,3) if rand == 2 then game.Lighting.Light:clone() Light.Parent = Workspace Light.Posistion = Workspace.Baseplate.Position.Vector3.new(0, 5, 0) end end
function ontouched() rand = math.random(1,3) if rand == 3 then game.Lighting.Medium:clone() Medium.Parent = Workspace Medium.Posistion = Workspace.Baseplate.Position.Vector3.new(0, 5, 0) wait() end end
script.Parent.Part.Touched:connect(ontouched) |
|
|
| Report Abuse |
|
|
Epic1230
|
  |
| Joined: 07 Dec 2011 |
| Total Posts: 289 |
|
|
| 03 Aug 2013 06:59 AM |
| Medium, Light, and Dark isn't a variable. |
|
|
| Report Abuse |
|
|
Epic1230
|
  |
| Joined: 07 Dec 2011 |
| Total Posts: 289 |
|
| |
|
thetacah
|
  |
| Joined: 18 Jan 2013 |
| Total Posts: 16026 |
|
|
| 03 Aug 2013 07:04 AM |
| No Medium, Light and Dark are the Parts i'm cloning! And I didn't misspell Position |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 07:07 AM |
You`re doing it wrong You cloned the part but didn`t set the clone as a variable. First you declare a variable then hook it to the clone like this: clone = part:Clone() Then you can change it`s properties like so: clone.Parent = game.Workspace |
|
|
| Report Abuse |
|
|
Epic1230
|
  |
| Joined: 07 Dec 2011 |
| Total Posts: 289 |
|
|
| 03 Aug 2013 07:08 AM |
| You said "Posistion". And you have to put a variable for the parts you're cloning or it won't work. Dark = [Model]:Clone() |
|
|
| Report Abuse |
|
|
Desperian
|
  |
| Joined: 07 Feb 2012 |
| Total Posts: 3371 |
|
|
| 03 Aug 2013 07:09 AM |
@OP, 1) Yes, you did spell 'Position' incorrectly. You spelt it 'Posistion'. (E.g. Dark.Posistion) 2) Yes, while it may be that they're called whatever, it's not a variable within the script. 3) That is not how you add positions. 4) Remember there's an output window.
-----
function ontouched() rand = math.random(1,3) local Selected = rand == 1 and game.Lighting.Dark:Clone() or rand == 2 and game.Lighting.Light:Clone() or rand == 3 and game.Lighting.Medium:Clone() Selected.Parent = Workspace Selected.Position = Workspace.Baseplate.Position + Vector3.new(0,5,0) end script.Parent.Part.Touched:connect(ontouched)
Or, if you want it you way...
function ontouched() rand = math.random(1,3) if rand == 1 then Selected = game.Lighting.Dark:Clone() elseif rand == 2 then Selected = game.Lighting.Light:Clone() elseif rand == 3 then Selected = game.Lighting.Medium:Clone() end Selected.Parent = Workspace Selected.Position = Workspace.Baseplate.Position + Vector3.new(0,5,0) end script.Parent.Part.Touched:connect(ontouched) |
|
|
| Report Abuse |
|
|
|
| 03 Aug 2013 07:20 AM |
| Ohh, I didn`t even look at the positions -Derp- |
|
|
| Report Abuse |
|
|