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 » Scripting Helpers
Home Search
 

Re: Simple question

Previous Thread :: Next Thread 
miz656 is not online. 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
stuntkid257 is not online. stuntkid257
Joined: 12 Jul 2010
Total Posts: 1394
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 is not online. miz656
Joined: 19 Jul 2010
Total Posts: 15336
23 Aug 2011 04:50 PM
Do you know?Anyone know?
Report Abuse
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
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
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
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
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
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 is not online. 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
ElectricBlaze is not online. ElectricBlaze
Joined: 18 Jul 2011
Total Posts: 22930
23 Aug 2011 04:54 PM
miz, as swim said, use mine. :3

-<-<-<-~~~In Soviet Russia, programs program you.~~~->->->-
Report Abuse
miz656 is not online. 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
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
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
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
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 is not online. 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
swimguy777 is not online. swimguy777
Joined: 30 May 2009
Total Posts: 17092
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 is not online. 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
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripting Helpers
   
 
   
  • 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