I have a script where my game cycles through three phases, the lobby phase, loading phase, and the game phase.
However at the end of the game phase, the bricks that have been cloned in are not being destroyed, and there are no errors.
Here is my code (btw the lt, l2t, and gt are intvalues representing the amount of time left in a specific phase):
01 | --{{VARIABLES}}-- |
02 | g = game.Workspace.gameRunner.inGame |
03 | s = g.Parent.status |
04 | gt = game.Workspace.gameRunner.gameTime |
05 | lt = game.Workspace.gameRunner.lobbyTime |
06 | l 2 t = game.Workspace.gameRunner.loadTime |
07 | --{{CHECKER}}-- |
08 | while true do |
09 | if l 2 t.Value = = 15 then |
10 | wait( 1 ) |
11 | game.ServerStorage.Fallen:MakeJoints() |
12 | game.ServerStorage.Fallen:Clone().Parent = game.Workspace |
13 | game.Workspace.Fallen.Name = "fallenCopy" |
14 | elseif gt = = 1 then |
15 | game.Workspace.fallenCopy:Destroy() |
16 | end |
17 | wait( 1 ) |
18 | end |
Here is another idea for a solution which also did not work:
01 | --{{VARIABLES}}-- |
02 | g = game.Workspace.gameRunner.inGame |
03 | s = g.Parent.status |
04 | gt = game.Workspace.gameRunner.gameTime |
05 | lt = game.Workspace.gameRunner.lobbyTime |
06 | l 2 t = game.Workspace.gameRunner.loadTime |
07 | --{{CHECKER}}-- |
08 | while true do |
09 | if l 2 t.Value = = 15 then |
10 | wait( 1 ) |
11 | game.ServerStorage.Fallen:MakeJoints() |
12 | game.ServerStorage.Fallen:Clone().Parent = game.Workspace |
13 | game.Workspace.Fallen.Name = "fallenCopy" |
14 | end |
15 | if gt = = 1 then |
16 | game.Workspace.fallenCopy:Destroy() |
17 | end |
18 | wait( 1 ) |
19 | end |
A solution would be highly appreciated as I have been stumped on this for a while!
Got it!! there was just a few mistakes i labeled them for you!!
01 | --{{VARIABLES}}-- |
02 | g = game.Workspace.gameRunner.inGame |
03 | gt = game.Workspace.gameRunner.gameTime |
04 | lt = game.Workspace.gameRunner.lobbyTime |
05 | l 2 t = game.Workspace.gameRunner.loadTime |
06 | --{{CHECKER}}-- |
07 | while true do |
08 | wait( 1 ) |
09 | if l 2 t.Value > = 15 then -- i recommened always using >= |
10 | --because at the odd chance that your game skips a count. |
11 | --your script will crash |
12 | l 2 t.Value = 0 -- this was causing an over copy remove if ya want |
13 | game.ServerStorage.Fallen:MakeJoints() |
14 | a = game.ServerStorage.Fallen:Clone() -- i prefer declaring it as a variable |
15 | a.Parent = game.Workspace |