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: This script crashed my game.

Previous Thread :: Next Thread 
Vyxium is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
24 Mar 2014 08:12 PM
Can somebody help me fix this script? I have a NumberValue that is initially 0 but every time a player says "regen", it makes the value go up by 1, and if the value reaches a certain number, it regens the cart in my game. The problem is, it just kept regenerating the carts as soon as the server started. I did not even chat anything and it just kept regenerating, probably because of the loop. Here is the script that regenerates the cart:

numpls = #game.Players:GetChildren()
numvts = script.Parent.Value

a = game.Workspace.Cart:Clone()

while wait() do
if numvts >= numpls * 0.50 then
a:Clone().Parent = game.Workspace
end
end

--If you wanna see the other script that adds the value when chatted just ask.
Report Abuse
tery215 is not online. tery215
Joined: 19 Aug 2009
Total Posts: 3879
24 Mar 2014 08:13 PM
numpls = #game.Players:GetChildren()
numvts = script.Parent.Value

a = game.Workspace.Cart:Clone()

while wait() do
if numvts >= numpls * 0.50 then
numpls = 0
a:Clone().Parent = game.Workspace
end
end

--If you wanna see the other script that adds the value when chatted just ask.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
24 Mar 2014 08:15 PM
Can somebody help me fix this script? I have a NumberValue that is initially 0 but every time a player says "regen", it makes the value go up by 1, and if the value reaches a certain number, it regens the cart in my game. The problem is, it just kept regenerating the carts as soon as the server started. I did not even chat anything and it just kept regenerating, probably because of the loop. Here is the script that regenerates the cart:


a = game.Workspace.Cart:Clone()

script.Parent.Changed:connect(function(numvsts)
if numvts >= #game.Players:players()* 0.50 then
a:Clone().Parent = game.Workspace
end
end)

--If you wanna see the other script that adds the value when chatted just ask.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
24 Mar 2014 08:16 PM
Ignore the fact it's a copy and paste lol.
Report Abuse
Vyxium is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
24 Mar 2014 08:16 PM
And what will that do? numpls is the number of players and I want it to regen if 50% of the players chat regen
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
24 Mar 2014 08:17 PM
The problem is the numbers never updates.

I just added supposed efficiently =P.
Report Abuse
Vyxium is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
24 Mar 2014 08:19 PM
thats why I put the loop so it continuously checks if the number updates, I have another script that updates the numbers
Report Abuse
Vyxium is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
24 Mar 2014 08:22 PM
Ok well, it clones it when you say regen but it all falls apart when it gets cloned...
Report Abuse
BogyMac is not online. BogyMac
Joined: 04 Nov 2011
Total Posts: 823
24 Mar 2014 08:24 PM
model:MakeJoints()
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
24 Mar 2014 08:24 PM
Vacuum, you defined the numbers ONCE and ONCE only.

That number will remain the same.



And when you clone it, use :MakeJoints() on it.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
24 Mar 2014 08:25 PM
Autocorrect called you vacuum, sorry.
Report Abuse
Vyxium is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
24 Mar 2014 08:27 PM
That's what I thought but I'm not too familiar with :MakeJoints(), do I do it before or after it gets cloned?
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
24 Mar 2014 08:28 PM
After
Report Abuse
Vyxium is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
24 Mar 2014 08:30 PM
So this is all I have to do?

numpls = #game.Players:players()
numvts = script.Parent.Value

a = game.Workspace.Cart:Clone()

script.Parent.Changed:connect(function(numvts)
if numvts >= numpls * 0.50 then
game.Workspace.Cart:Remove()
a:Clone().Parent = game.Workspace
a:MakeJoints()
end
end)
Report Abuse
Vyxium is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
24 Mar 2014 08:33 PM
Yea, that did not work at all ^^
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
24 Mar 2014 08:37 PM
So this is all I have to do?

numpls = game.Players


a = game.Workspace.Cart:Clone()

script.Parent.Changed:connect(function(numvts)
if numvts >= numpls.NumPlayer*0.50 then
game.Workspace.Cart:Remove()
local clone = a:clone()
clone:MakeJoints()
a.Parent = game.Workspace
end
end)
Report Abuse
Vyxium is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
24 Mar 2014 08:40 PM
derp.
Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
24 Mar 2014 08:40 PM
Add an s to NumPlayer
So,it's NumPlayers
Report Abuse
Vyxium is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
24 Mar 2014 08:48 PM
I kinda just took parts from all the scripts lol so I got all kinds of variables but i know what u mean.
Report Abuse
Vyxium is not online. Vyxium
Joined: 31 Aug 2010
Total Posts: 1020
24 Mar 2014 08:53 PM
ahhhhh, don't you just love that feeling when you get a script to work? :D

but now does it work with more than 1 person? 0. o

Report Abuse
Bebee2 is not online. Bebee2
Joined: 17 May 2009
Total Posts: 3985
24 Mar 2014 08:54 PM
Mhm.
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