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
 

Re: Bool value not changing...

Previous Thread :: Next Thread 
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
24 Feb 2015 08:32 PM
I have a script that places the following script into a Bool value.

wait(1)
script.Parent.Value = false

When I test it though, the Bool value isn't changed even thought the script is inside the value and it is not disabled. I'm not getting any errors from the output either....
What's wrong with this?
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
24 Feb 2015 08:41 PM
A) The script is disabled.
B) It isn't a BoolValue.
C) It is a BoolValue already set to false.
Report Abuse
Rocky28447 is online. Rocky28447
Joined: 11 Dec 2009
Total Posts: 2912
24 Feb 2015 08:42 PM
Those were just possibilities, I'm not saying they are true.
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
24 Feb 2015 09:27 PM
I am 100% sure it is a Bool value set to true...
Report Abuse
ChuckXZ is not online. ChuckXZ
Joined: 26 Jan 2012
Total Posts: 2996
24 Feb 2015 09:29 PM
There isn't a function running.
Report Abuse
Hazania is not online. Hazania
Joined: 04 Jun 2010
Total Posts: 1344
24 Feb 2015 09:30 PM
Unless this script is incidentally running before the item with the bool is done loading then I have no idea what the problem is. Try running a longer wait..?
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
24 Feb 2015 09:59 PM
Apparently, this script doesn't even work, I added print("Test") after wait(1) and nothing happened in the output...
Report Abuse
micke3212 is not online. micke3212
Joined: 24 Nov 2009
Total Posts: 3000
24 Feb 2015 10:00 PM
Here's something way better, it's called Variables...


local values = true

wait(1)
values = false

if values == false then print("HALLELUJAH")
end
Report Abuse
TooKawaiiForSenpai is not online. TooKawaiiForSenpai
Joined: 03 Mar 2009
Total Posts: 3241
24 Feb 2015 10:02 PM
Some objects on roblox block the execution of scripts. That is, I think whether or not the script is interpreted depends on its location. I'm not 100% sure on this but it is the most likely possibility.
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
24 Feb 2015 10:03 PM
Variables won't work because the script is for a tool and I don't want people to be able to skip the cooldown by resetting, so instead, I'm using values that spawn inside a player(not the character, but the one with the playerguis.)
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
24 Feb 2015 10:04 PM
@TooKawaii, what do you mean by objects? How do I fix it if there are objects blocking the script from executing?
Report Abuse
micke3212 is not online. micke3212
Joined: 24 Nov 2009
Total Posts: 3000
24 Feb 2015 10:04 PM
You actually can use DataStore and still keep it all in script.
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
24 Feb 2015 10:09 PM
Is DataStore new? I haven't heard of it before. I quit Roblox a year ago and I recently came back. I probably missed it. How do you use it?
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
24 Feb 2015 10:10 PM
Does anyone know why the Bool value is not changing though?
Report Abuse
TooKawaiiForSenpai is not online. TooKawaiiForSenpai
Joined: 03 Mar 2009
Total Posts: 3241
24 Feb 2015 10:12 PM
One sec, checking my theory
Report Abuse
TooKawaiiForSenpai is not online. TooKawaiiForSenpai
Joined: 03 Mar 2009
Total Posts: 3241
24 Feb 2015 10:14 PM
No, it works.

Here's my setup
/qIfsvXA
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
24 Feb 2015 10:16 PM
Here is a shortened version of the script.

mouse.KeyDown:connect(function(key)
if key == "q" then
[Random Function and stuff here]
game.Players.LocalPlayer.Ability1.Value = true
local clone = script.CoolDownScript:Clone()
clone.Parent = game.Players.LocalPlayer.Ability1
clone.Disabled = false
end
end)
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
24 Feb 2015 10:16 PM
What's /qIfsvXA
Report Abuse
Hazania is not online. Hazania
Joined: 04 Jun 2010
Total Posts: 1344
24 Feb 2015 10:17 PM
You could always use a global variable rather than making an actual bool. Either way I don't know why it is not allowing you to change the bool unless it isn't running that part of the code at all.
Report Abuse
TooKawaiiForSenpai is not online. TooKawaiiForSenpai
Joined: 03 Mar 2009
Total Posts: 3241
24 Feb 2015 10:18 PM
And I'm guessing the cooldown changes the value back?
Try a coroutine instead. It does the same thing you're looking to do.
coroutines run code at the same time as the rest of your code.

local cor = coroutine.create(function()
--do stuff
--You can have loops and stuff
--if you wait() in a coroutine it wont pause the code outside of it
end)
coroutine.resume(cor)
Report Abuse
TooKawaiiForSenpai is not online. TooKawaiiForSenpai
Joined: 03 Mar 2009
Total Posts: 3241
24 Feb 2015 10:18 PM
For a cooldown, try Delay()

http://wiki.roblox.com/index.php?title=Function_dump/Functions_specific_to_ROBLOX#Delay
Report Abuse
TooKawaiiForSenpai is not online. TooKawaiiForSenpai
Joined: 03 Mar 2009
Total Posts: 3241
24 Feb 2015 10:19 PM
it's an i.m.g.u.r link to a screenshot I did
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
24 Feb 2015 11:36 PM
I'm going to try the delay. It definitely seems cleaner than making a new variable. Also, how do you make a global variable? And how do you get the variable from another script
Report Abuse
Crazy010517 is not online. Crazy010517
Joined: 17 Sep 2011
Total Posts: 1161
25 Feb 2015 12:05 AM
What do you know?
Delay worked :)))
Report Abuse
Hazania is not online. Hazania
Joined: 04 Jun 2010
Total Posts: 1344
26 Feb 2015 08:47 PM
for future projects this is global variables
http://wiki.roblox.com/index.php?title=Variables#Global_Variables
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