|
| 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 |
|
|
|
| 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 |
|
|
|
| 24 Feb 2015 08:42 PM |
| Those were just possibilities, I'm not saying they are true. |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 09:27 PM |
| I am 100% sure it is a Bool value set to true... |
|
|
| Report Abuse |
|
|
ChuckXZ
|
  |
| Joined: 26 Jan 2012 |
| Total Posts: 2996 |
|
|
| 24 Feb 2015 09:29 PM |
| There isn't a function running. |
|
|
| Report Abuse |
|
|
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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 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
|
  |
| 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 |
|
|
|
| 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 |
|
|
|
| 24 Feb 2015 10:10 PM |
| Does anyone know why the Bool value is not changing though? |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 10:12 PM |
| One sec, checking my theory |
|
|
| Report Abuse |
|
|
|
| 24 Feb 2015 10:14 PM |
No, it works.
Here's my setup /qIfsvXA |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
| |
|
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 |
|
|
|
| 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 |
|
|
|
| 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 |
|
|
|
| 24 Feb 2015 10:19 PM |
| it's an i.m.g.u.r link to a screenshot I did |
|
|
| Report Abuse |
|
|
|
| 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 |
|
|
|
| 25 Feb 2015 12:05 AM |
What do you know? Delay worked :))) |
|
|
| Report Abuse |
|
|
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 |
|
|