0PTlCJoin Date: 2010-12-13 Post Count: 17 |
Hi all-
I am working on a run script right now that disables crouching while you run. I wrote "Tool.Crouch.Disabled = true" and then wrote the lines of the run script. After that I wrote the same thing except false, so it disables. The problem is, the crouch script does not work after you disable it. Does anyone know why? |
|
TaslemGuyJoin Date: 2009-06-10 Post Count: 12174 |
|
|
0PTlCJoin Date: 2010-12-13 Post Count: 17 |
The point was, does anyone have any idea why it would not re-enable? |
|
|
Try Scripting Helpers.Also, recopy the script, it'll work again. |
|
miloguyJoin Date: 2009-12-19 Post Count: 7702 |
Enabling a script doesn't run it.
Try this:
function runScript(s)
local c=s:clone()
c.Disabled=false
c.Parent=s.Parent
s:Remove()
end |
|
0PTlCJoin Date: 2010-12-13 Post Count: 17 |
Okay, thanks. I will try that.
So basically your saying, that enabling the script doesn't make it run, you have to make it run after you enable it to make it work? |
|
miloguyJoin Date: 2009-12-19 Post Count: 7702 |
Yeah. Moving a script's parent runs it if it's not disabled. |
|
0PTlCJoin Date: 2010-12-13 Post Count: 17 |
So do I replace the c or s with the scripts name? |
|
miloguyJoin Date: 2009-12-19 Post Count: 7702 |
Neither.
You add that function to your code, then later call
runScript(SCRIPT'S NAME HERE)
to run that script |
|
0PTlCJoin Date: 2010-12-13 Post Count: 17 |
Still didn't work. I tried running the scripts again. |
|
MrBCGamesJoin Date: 2011-01-19 Post Count: 439 |
For one, I can tell your not using edit mode. Second, you disabled the script, therefor it cannot be re-enabled using the disabled script. |
|
miloguyJoin Date: 2009-12-19 Post Count: 7702 |
@Opt
I don't know, just make it enable it, then re-parent it or something |
|