|
| 04 Mar 2015 11:26 AM |
Hi, I've been trying to make a timer for my game for a while now but it wont recognize that change of a variable in one script in another. This is currently the script I have.
function Timer2() print'Timer 2 active' game.Workspace.h.Parent = game.Workspace game.Workspace.h.Text = 'There are '..game.Workspace.TimeLeft.Value..' seconds left' if game.Workspace.TimeLeft.Value >= 1 and game.Workspace.Timer2.Value == "Yes" then print'Choice 1' wait(1) game.Workspace.TimeLeft.Value = game.Workspace.TimeLeft.Value - 1 Timer2() elseif game.Workspace.Timer2.Value == "No" then game.Workspace.h.Text = "" print'Choice2' CheckTimers() else print'Choice 3' game.Workspace.PointsToWin.Value = 0 wait(1) game.Workspace.Kill2Players.Value = "Yes" wait(5) game.Workspace.Timer2.Value = "No" CheckTimers() end end
When Kill2Players turns to yes this this is supposed to happen.
elseif game.Workspace.Kill2Players.Value == "Yes" then print'Made it to the function' Warrior1.Character.Humanoid.Health = 0 Warrior2.Character.Humanoid.Health = 0 StartingMap.Parent = game.Lighting wait(10) NewRound()
However it does not even see that the variable has changed even though the second script is constantly looping. The output does not suggest any errors and the entire second script won't run. And help will be greatly appreciated. Thanks. |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 11:33 AM |
| It won't notice it if you are are changing the value with a localscript, then try to fetch it with a server-side script (If you have FilteringEnabled on). |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 11:34 AM |
Also, what is the point in this? game.Workspace.h.Parent = game.Workspace
h is already in workspace. |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 11:34 AM |
| Yeah, it used to be a local script but when I changed it I forgot to put it back. |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 11:36 AM |
| Also this isn't a local script. The variable I'm changing is just sitting in Workspace. I'm using it as a way to communicate between scripts. |
|
|
| Report Abuse |
|
|
| |
|
|
| 04 Mar 2015 11:37 AM |
| No, the second script won't recognize the variable changed... |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 11:37 AM |
| Add prints()'s, to see where/if it errors/stops running. |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 11:39 AM |
| I did. That's what the print'Made it to function' is for. It's also in every elseif on that same statement. None of them ever reach the output. |
|
|
| Report Abuse |
|
|
|
| 04 Mar 2015 11:40 AM |
| Also on the first script the print'Choice 3' does reach the output and the actualy variable is changed in the workspace but when the second script goes into the workspace to check the same variable it doesn't recognize it. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|