|
| 14 Aug 2012 05:10 AM |
Hi, this doesn't seem to be working, I wondered if anyone could see the problem and fix it?
Thanks.
while true do if game.Workspace.Values.PowerUps.Amount = < 6 then
local copy=game.Lighting.PowerUps:findFirstChild("ShinySwords"):clone() copy.Parent=workspace copy:makeJoints()
local xmaximum=20 local xminimum=-20 local zmaximum=20 local zminimum=-20
copy:moveTo(Vector3.new(math.random(xminimum,xmaximum), 0, math.random(zminimum,zmaximum))) game.Workspace.Values.PowerUps.Amount = game.Workspace.Values.PowerUps.Amount + 1 end
wait(5)
end
Output: Workspace.Scripts.Powerup Adder:2: unexpected symbol near '<' Workspace.Scripts.Powerup Adder:2: 'then' expected near '=' |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 05:27 AM |
| <=, the bracket goes first and then the equal sign |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Aug 2012 05:31 AM |
| The Object doesn't seem to be cloning...? |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Aug 2012 05:46 AM |
Try: local copy=game.Lighting.PowerUps:FindFirstChild("ShinySwords") copy:clone() |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 06:05 AM |
Script is now
while true do if game.Workspace.Values.PowerUps.Amount <=6 then
local copy=game.Lighting.PowerUps:FindFirstChild("ShinySwords") copy:clone() --[==[ local copy=game.Lighting.PowerUps:findFirstChild("ShinySwords"):clone() copy.Parent=workspace copy:makeJoints()
local xmaximum=20 local xminimum=-20 local zmaximum=20 local zminimum=-20
copy:moveTo(Vector3.new(math.random(xminimum,xmaximum), 0, math.random(zminimum,zmaximum))) ]==] game.Workspace.Values.PowerUps.Amount = game.Workspace.Values.PowerUps.Amount + 1 end
wait(5)
end
Output: Workspace.Scripts.PowerUp Adder:2: attempt to compare userdata with number
|
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 06:10 AM |
game.Workspace.Values.PowerUps.Amount.Value
|
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 06:18 AM |
Thanks.
Output is now:
Workspace.Scripts.Powerup Adder:19: attempt to perform arithmetic on field 'Amount' (a userdata value)
Current Script: while true do if game.Workspace.Values.PowerUps.Amount.Value <=6 then
local copy=game.Lighting.PowerUps:FindFirstChild("ShinySwords") copy:clone() --[==[ local copy=game.Lighting.PowerUps:findFirstChild("ShinySwords"):clone() copy.Parent=workspace copy:makeJoints()
local xmaximum=20 local xminimum=-20 local zmaximum=20 local zminimum=-20
copy:moveTo(Vector3.new(math.random(xminimum,xmaximum), 0, math.random(zminimum,zmaximum))) ]==] game.Workspace.Values.PowerUps.Amount = game.Workspace.Values.PowerUps.Amount + 1 end
wait(5)
end
|
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 06:26 AM |
| Do the same thing, but with that line |
|
|
| Report Abuse |
|
|
| |
|
|
| 14 Aug 2012 06:43 AM |
Would this work?
local copy=game.Lighting.PowerUps:FindFirstChild("ShinySwords") clone=copy:clone() clone.Name = "ShinySwordsPU" |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 06:58 AM |
| Also, I can't see the model anywhere. |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 06:58 AM |
| clone.Parent = game.Workspace |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 07:00 AM |
Thanks.
I would like them to appear in random places in the map, not just in one place? |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 07:03 AM |
| Because currently they just appear in one place. |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 07:07 AM |
--Map Boundaries-- x = 50 z = 50 --Code--
clone=game.Lighting.PowerUps:FindFirstChild("ShinySwords"):Clone() clone.Name = "ShinySwordsPU" clone.Parent = game.Workspace clone:MoveTo(Vector3.new(math.random(-x,x), 10, math.random(-z,z))) |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 07:14 AM |
Thanks!
For some reason, it seems to be spawning 7 in total, not 6.
Does anyone know why? |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 07:17 AM |
| The line above "wait(5)" hast he mistake. You missed ".Value" and "Amount" in the first part before the "=" |
|
|
| Report Abuse |
|
|
|
| 14 Aug 2012 07:55 AM |
That is fixed. Thanks
But does anyone know why it clones 7 models rather than 6? |
|
|
| Report Abuse |
|
|
| |
|