|
| 14 Jul 2010 07:51 PM |
while true do wave = script.Parent.Stats.CurrentWave.value waveStats = script.Parent.Waves.Waves:findFirstChild("Wave" ..tostring(wave)).Stats waveMonsters = waveStats.Monsters.Monsters.Value for i = 1,#waveMonsters do enemy = script.Parent.Enemy:clone() Enemy.Parent = script.Parent.Enemys Enemy.Position = script.Parent.Enemys.Positions.Start.Position wait(2) end
while true do while true do if script.Parent.Parent.Parent.GameEnabled == true then break end wait(2) end for i = 1, waveMonsters do start = script.Parent.Enemys.Positions.StartPosition.Position e = script.Parent.Enemys:getChildren() for a = 1, #e do e[a].Position = UDim.new(0, (start.X.Offset), 0, (start.Y.Offset)) T = script.Parent.Enemys.Positions.Turns:getChildren() for b = 1,#T do turn = script.Parent.Enemys.Positions.Turns:findFirstChild("Turn" ..tostring(b)) if (turn~=nil) then if ((turn.Position.X.Offset) - (e[a].Position.X.Offset)) > 0 and if ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) > 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset + 5), 0, (e[a].Position.Y.Offset - 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - (e[a].Position.X.Offset)) > 0 and if ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) < 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset + 5), 0, (e[a].Position.Y.Offset + 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - (e[a].Position.X.Offset)) > 0 and if ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) = 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset + 5), 0, (e[a].Position.Y.Offset)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - [a]e.Position.X.Offset)) < 0 and if ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) < 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset - 5), 0, (e[a].Position.Y.Offset + 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - [a]e.Position.X.Offset)) < 0 and if ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) = 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset - 5), 0, (e[a].Position.Y.Offset)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - [a]e.Position.X.Offset)) < 0 and if ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) > 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset - 5), 0, (e[a].Position.Y.Offset - 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - [a]e.Position.X.Offset)) = 0 and if ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) = 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset), 0, (e[a].Position.Y.Offset)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - e[a].Position.X.Offset)) = 0 and if ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) < 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset), 0, (e[a].Position.Y.Offset + 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - [a]e.Position.X.Offset)) = 0 and if ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) > 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset), 0, (e[a].Position.Y.Offset - 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- end end end end end end end end end repeat until [a]e.Position = turn.Position end end end end wait() end wait() end
output --> Wed Jul 14 20:48:13 2010 - Players.Player.PlayerGui.ScreenGui.MainFrame.Games.Game1.GameScript:26: unexpected symbol near 'if' |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2010 08:04 PM |
| Will someone please help me |
|
|
| Report Abuse |
|
|
lucas668
|
  |
| Joined: 18 Jun 2008 |
| Total Posts: 6183 |
|
|
| 14 Jul 2010 08:07 PM |
Right above where the output said to look:
while true do while true do
I don't know for sure, but I think this is the problem. |
|
|
| Report Abuse |
|
|
Blaboblox
|
  |
| Joined: 12 Sep 2008 |
| Total Posts: 8945 |
|
|
| 14 Jul 2010 08:08 PM |
| It's not "and if"; it's just "and" |
|
|
| Report Abuse |
|
|
ellosss
|
  |
| Joined: 15 Mar 2009 |
| Total Posts: 7030 |
|
|
| 14 Jul 2010 08:08 PM |
while true do while true do?! |
|
|
| Report Abuse |
|
|
Shobobo99
|
  |
| Joined: 30 Dec 2008 |
| Total Posts: 5754 |
|
|
| 14 Jul 2010 08:08 PM |
| when in the if statement the "=" signs must be doubled so its == not = |
|
|
| Report Abuse |
|
|
ellosss
|
  |
| Joined: 15 Mar 2009 |
| Total Posts: 7030 |
|
|
| 14 Jul 2010 08:11 PM |
| this is a script that you can throw away in the wastebin! |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2010 08:20 PM |
Sorry about all the errors, I just noticed them when I was looking at it after I posted it. My fixed script is
while true do wave = script.Parent.Stats.CurrentWave.value waveStats = script.Parent.Waves.Waves:findFirstChild("Wave" ..tostring(wave)).Stats waveMonsters = waveStats.Monsters.Monsters.Value for i = 1,#waveMonsters do enemy = script.Parent.Enemy:clone() Enemy.Parent = script.Parent.Enemys Enemy.Position = script.Parent.Enemys.Positions.Start.Position wait(2) end
while true do if script.Parent.Parent.Parent.GameEnabled == true then break end wait(2) end for i = 1, waveMonsters do start = script.Parent.Enemys.Positions.StartPosition.Position e = script.Parent.Enemys:getChildren() for a = 1, #e do e[a].Position = UDim.new(0, (start.X.Offset), 0, (start.Y.Offset)) T = script.Parent.Enemys.Positions.Turns:getChildren() for b = 1,#T do turn = script.Parent.Enemys.Positions.Turns:findFirstChild("Turn" ..tostring(b)) if (turn~=nil) then if ((turn.Position.X.Offset) - (e[a].Position.X.Offset)) > 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) > 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset + 5), 0, (e[a].Position.Y.Offset - 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - (e[a].Position.X.Offset)) > 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) < 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset + 5), 0, (e[a].Position.Y.Offset + 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - (e[a].Position.X.Offset)) > 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) == 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset + 5), 0, (e[a].Position.Y.Offset)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - e[a].Position.X.Offset)) < 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) < 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset - 5), 0, (e[a].Position.Y.Offset + 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - e[a].Position.X.Offset)) < 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) == 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset - 5), 0, (e[a].Position.Y.Offset)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - e[a].Position.X.Offset)) < 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) > 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset - 5), 0, (e[a].Position.Y.Offset - 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - e[a].Position.X.Offset)) == 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) == 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset), 0, (e[a].Position.Y.Offset)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - e[a].Position.X.Offset)) == 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) < 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset), 0, (e[a].Position.Y.Offset + 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- else if ((turn.Position.X.Offset) - e[a].Position.X.Offset)) == 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) > 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset), 0, (e[a].Position.Y.Offset - 5)) ------------------------------------------------------------------------------------------------------------------------------------------------------------------------- end end end end end end end end end repeat until [a]e.Position = turn.Position end end end end wait() end
and the output says --> Wed Jul 14 21:16:23 2010 - Players.Player.PlayerGui.GemCraft.MainFrame.Games.Game1.GameScript:34: 'then' expected near ')'
The script is suppose to make an image button called enemy to move to each position. Kind of like a tower defence game, if you can fix, make me a new one please do, again sorry for the errors it was late at night when I wrote this script and it was in a hurry. |
|
|
| Report Abuse |
|
|
ellosss
|
  |
| Joined: 15 Mar 2009 |
| Total Posts: 7030 |
|
|
| 14 Jul 2010 08:22 PM |
| make every 'else if' elseif and remove most of the ends and the repeat at the bottom makes no sence it repeats nothing. |
|
|
| Report Abuse |
|
|
ellosss
|
  |
| Joined: 15 Mar 2009 |
| Total Posts: 7030 |
|
|
| 14 Jul 2010 08:25 PM |
| Oh and remove all those ines in between them. that makes it ahrder to read |
|
|
| Report Abuse |
|
|
|
| 14 Jul 2010 08:26 PM |
I did and the output says Wed Jul 14 21:25:46 2010 - Players.Player.PlayerGui.ScreenGui.MainFrame.Games.Game1.Gam:5: attempt to get length of global 'waveMonsters' (a number value) Wed Jul 14 21:25:46 2010 - Players.Player.PlayerGui.ScreenGui.MainFrame.Games.Game1.GameScr, line 5 stack end |
|
|
| Report Abuse |
|
|
| |
|
Blaboblox
|
  |
| Joined: 12 Sep 2008 |
| Total Posts: 8945 |
|
| |
|
|
| 14 Jul 2010 08:34 PM |
Wed Jul 14 21:31:26 2010 - Players.Player.PlayerGui.GemCraft.MainFrame.Games.Game1.Gam:7: attempt to index global 'Enemy' (a nil value) Wed Jul 14 21:31:26 2010 - Players.Player.PlayerGui.GemCraft.MainFrame.Games.Game1.GameScr, line 7 stack end
I really dont understand why this happened |
|
|
| Report Abuse |
|
|
ellosss
|
  |
| Joined: 15 Mar 2009 |
| Total Posts: 7030 |
|
|
| 14 Jul 2010 08:39 PM |
while wait() do wave = script.Parent.Stats.CurrentWave.value waveStats = script.Parent.Waves.Waves:findFirstChild("Wave" ..tostring(wave)).Stats waveMonsters = waveStats.Monsters.Monsters.Value for i = 1,#waveMonsters do enemy = script.Parent.Enemy:clone() Enemy.Parent = script.Parent.Enemys Enemy.Position = script.Parent.Enemys.Positions.Start.Position wait(2) end end while wait() do if script.Parent.Parent.Parent.GameEnabled == true then break end wait(2) end for i = 1, waveMonsters do start = script.Parent.Enemys.Positions.StartPosition.Position e = script.Parent.Enemys:getChildren() for a = 1, #e do e[a].Position = UDim.new(0, (start.X.Offset), 0, (start.Y.Offset)) T = script.Parent.Enemys.Positions.Turns:getChildren() for b = 1,#T do turn = script.Parent.Enemys.Positions.Turns:findFirstChild("Turn" ..tostring(b)) if (turn~=nil) then if ((turn.Position.X.Offset) - (e[a].Position.X.Offset)) > 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) > 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset + 5), 0, (e[a].Position.Y.Offset - 5)) elseif ((turn.Position.X.Offset) - (e[a].Position.X.Offset)) > 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) < 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset + 5), 0, (e[a].Position.Y.Offset + 5)) elseif ((turn.Position.X.Offset) - (e[a].Position.X.Offset)) > 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) == 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset + 5), 0, (e[a].Position.Y.Offset)) elseif ((turn.Position.X.Offset) - e[a].Position.X.Offset)) < 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) < 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset - 5), 0, (e[a].Position.Y.Offset + 5)) elseif ((turn.Position.X.Offset) - e[a].Position.X.Offset)) < 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) == 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset - 5), 0, (e[a].Position.Y.Offset)) elseif ((turn.Position.X.Offset) - e[a].Position.X.Offset)) < 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) > 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset - 5), 0, (e[a].Position.Y.Offset - 5)) elseif ((turn.Position.X.Offset) - e[a].Position.X.Offset)) == 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) == 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset), 0, (e[a].Position.Y.Offset)) elseif ((turn.Position.X.Offset) - e[a].Position.X.Offset)) == 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) < 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset), 0, (e[a].Position.Y.Offset + 5)) elseif ((turn.Position.X.Offset) - e[a].Position.X.Offset)) == 0 and ((turn.Position.Y.Offset) - (e[a].Position.Y.Offset)) > 0 then e[a].Position = UDim.new(0, (e[a].Position.X.Offset), 0, (e[a].Position.Y.Offset - 5)) end end end end end |
|
|
| Report Abuse |
|
|