generic image
Processing...
  • Games
  • Catalog
  • Develop
  • Robux
  • Search in Players
  • Search in Games
  • Search in Catalog
  • Search in Groups
  • Search in Library
  • Log In
  • Sign Up
  • Games
  • Catalog
  • Develop
  • Robux
   
ROBLOX Forum » Game Creation and Development » Scripters
Home Search
 

Variable Crossing Scripts

Previous Thread :: Next Thread 
bluefrog53 is not online. bluefrog53
Joined: 05 Feb 2012
Total Posts: 766
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
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
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
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
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
bluefrog53 is not online. bluefrog53
Joined: 05 Feb 2012
Total Posts: 766
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
bluefrog53 is not online. bluefrog53
Joined: 05 Feb 2012
Total Posts: 766
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
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
04 Mar 2015 11:36 AM
So, it's fixed now?
Report Abuse
bluefrog53 is not online. bluefrog53
Joined: 05 Feb 2012
Total Posts: 766
04 Mar 2015 11:37 AM
No, the second script won't recognize the variable changed...
Report Abuse
epicbreaker is not online. epicbreaker
Joined: 23 Apr 2011
Total Posts: 2791
04 Mar 2015 11:37 AM
Add prints()'s, to see where/if it errors/stops running.
Report Abuse
bluefrog53 is not online. bluefrog53
Joined: 05 Feb 2012
Total Posts: 766
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
bluefrog53 is not online. bluefrog53
Joined: 05 Feb 2012
Total Posts: 766
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
bluefrog53 is not online. bluefrog53
Joined: 05 Feb 2012
Total Posts: 766
04 Mar 2015 11:47 AM
Bump
Report Abuse
bluefrog53 is not online. bluefrog53
Joined: 05 Feb 2012
Total Posts: 766
04 Mar 2015 11:57 AM
Bump2
Report Abuse
bluefrog53 is not online. bluefrog53
Joined: 05 Feb 2012
Total Posts: 766
04 Mar 2015 12:32 PM
Bump3
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • About Us
  • Jobs
  • Blog
  • Parents
  • Help
  • Terms
  • Privacy

©2017 Roblox Corporation. Roblox, the Roblox logo, Robux, Bloxy, and Powering Imagination are among our registered and unregistered trademarks in the U.S. and other countries.



Progress
Starting Roblox...
Connecting to Players...
R R

Roblox is now loading. Get ready to play!

R R

You're moments away from getting into the game!

Click here for help

Check Remember my choice and click Launch Application in the dialog box above to join games faster in the future!

Gameplay sponsored by:
Loading 0% - Starting game...
Get more with Builders Club! Join Builders Club
Choose Your Avatar
I have an account
generic image