miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 23 Aug 2011 04:35 PM |
Is there some function or something where it stops all scripts?Example
if game.Players.Player > = 1 then the function or something... |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2011 04:47 PM |
If there is, please tell me :3 I wanted to know that too a while ago. |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
| |
|
|
| 23 Aug 2011 04:51 PM |
function stopScripts(obj) for i,v in pairs(obj:GetChildren()) do if v:IsA("Script") then v.Disabled = true else stopScripts(v) end end end
stopScripts(game)
-<-<-<-~~~In Soviet Russia, programs program you.~~~->->->- |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2011 04:52 PM |
function scan(obj) wait() if obj:IsA("Script") then obj.Disabled = false else scan(obj) end end
if game.Players.NumPlayers <= 1 then scan(workspace)
~~{I'm a dangerous sociopath with a long history of violence}~~ ~{I don't understand how you keep forgetting that}~ |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2011 04:53 PM |
Use electric's. Mine doesn't work right D:
~~{I'm a dangerous sociopath with a long history of violence}~~ ~{I don't understand how you keep forgetting that}~ |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 23 Aug 2011 04:53 PM |
| AND I KNOW theres gotta be something like that!Because when you go to a war game like sword fighting tournament theres a hint saying you need 2players and know scripts run.But when 2 people are on the scripts are working. |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2011 04:54 PM |
miz, as swim said, use mine. :3
-<-<-<-~~~In Soviet Russia, programs program you.~~~->->->- |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 23 Aug 2011 05:03 PM |
@eletricblaze Ima add on the script so its what I want.
function stopScripts(obj) for i,v in pairs(obj:GetChildren()) do if v:IsA("Script") then v.Disabled = true else stopScripts(v) end end end
if Players.Player >=1 then function RunScripts(obj) for i,v inpairs(obj:GetChildren()) do v.Disabled = false end end
--Woouldn't you need a connection line?And would this work? |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2011 05:06 PM |
Edit. This stops all scripts if numplayers <= 1 and starts them if it's > 1.
function stopScripts(obj,bool) for i,v in pairs(obj:GetChildren()) do if v:IsA("Script") and bool then v.Disabled = true elseif not bool then v.DisAbled = false else stopScripts(v,bool) end end end
if game.Players.NumPlayers <= 1 then stopScripts(workspace,false) else stopScripts(workspace,true)
~~{I'm a dangerous sociopath with a long history of violence}~~ ~{I don't understand how you keep forgetting that}~ |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2011 05:08 PM |
Made it better:
function stopScripts(obj,bool) wait() for i,v in pairs(obj:GetChildren()) do if v:IsA("Script")then v.Disabled = bool else stopScripts(v,bool) end end end
if game.Players.NumPlayers <= 1 then stopScripts(workspace,false) else stopScripts(workspace,true)
~~{I'm a dangerous sociopath with a long history of violence}~~ ~{I don't understand how you keep forgetting that}~ |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 23 Aug 2011 05:12 PM |
Would the second script work?It looks easier to study.
Also, wouldnt you need a connection line for the function? |
|
|
| Report Abuse |
|
|
|
| 23 Aug 2011 05:14 PM |
It does have a connection line. Two of them, actually.
stopScripts(workspace,false) and stopScripts(workspace,true)
~~{I'm a dangerous sociopath with a long history of violence}~~ ~{I don't understand how you keep forgetting that}~ |
|
|
| Report Abuse |
|
|
miz656
|
  |
| Joined: 19 Jul 2010 |
| Total Posts: 15336 |
|
|
| 23 Aug 2011 05:21 PM |
| Oh, I didn't notice taht.And you sure thats gonna works? |
|
|
| Report Abuse |
|
|