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 » Scripters
Home Search
 

Re: Why do scripts in PlayerGui start executing twice?

Previous Thread :: Next Thread 
NVI is not online. NVI
Joined: 11 Jan 2009
Total Posts: 4744
02 Mar 2013 02:43 PM
This is another big problem I have with Roblox - there's no decent way to run a script on the player without some stupid problem like this.

Like in my "smash" game - only online - you get two cruisers popping up at first. Why? It's a simple script in a ScreenGui.
Report Abuse
BAUER102 is not online. BAUER102
Joined: 03 Apr 2010
Total Posts: 5936
02 Mar 2013 02:45 PM
Local script or normal script?
Report Abuse
NVI is not online. NVI
Joined: 11 Jan 2009
Total Posts: 4744
02 Mar 2013 02:46 PM
Local, obviously
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
02 Mar 2013 02:48 PM
Try putting a bool value inside of the script, and put this at the top of the script.

local run = script:FindFirstChild("HasRun")
if run ~= nil then
if run.Value == true then
error("Already ran the script", 0)
end
end

Only real way to fix it until the developers update roblox, and surprise us all by listening to the forums.
Report Abuse
NVI is not online. NVI
Joined: 11 Jan 2009
Total Posts: 4744
02 Mar 2013 02:50 PM
Ugh, I hate fixes like that. Roblox's sequencing is so bad that it's bound not to work anyway.
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
02 Mar 2013 02:53 PM
Well, try it anyway. That or just use

repeat wait() until script:IsDescendantOf(game.Players)

then define the localplayer later.
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
02 Mar 2013 03:01 PM
NVI, why are you being so bitter?

We're only kiddies.
Report Abuse
HEAT507 is not online. HEAT507
Joined: 31 Aug 2012
Total Posts: 429
02 Mar 2013 04:12 PM

local bx=nil
local v=nil
if bx,v=~nil then
return bx,v
print('l0l fail');
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
02 Mar 2013 04:13 PM
Heat, what does that even do?
Report Abuse
triston220 is not online. triston220
Joined: 08 Mar 2010
Total Posts: 1861
02 Mar 2013 04:24 PM
Well, make the script create half a cruiser, then when the script executes twice, you'll have a full one. :D

~~~~Need a scripter? PM me. https://twitter.com/triston220Roblo ~~~~
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
02 Mar 2013 04:25 PM
Wonderful triston. Just wonderful.
Report Abuse
coplox is not online. coplox
Joined: 07 Jun 2008
Total Posts: 3252
02 Mar 2013 04:27 PM
Bottom line is, ROBLOX needs to feex der gaem
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
02 Mar 2013 04:32 PM
I don't have this problem... Are you using a non-standard way of placing the LocalScripts in the PlayerGui?
Report Abuse
Prehistoricman is not online. Prehistoricman
Joined: 20 Sep 2008
Total Posts: 12490
02 Mar 2013 04:43 PM
I can confirm this is an issue (or at least it was). Here is a way to test:

Make a Localscript for the StarterGui which creates a value in the Workspace.
You will get two values when you join.
Report Abuse
iIikeyou is not online. iIikeyou
Joined: 07 Mar 2012
Total Posts: 1659
02 Mar 2013 05:02 PM
repeat wait(.03)until game:GetService'Players'.LocalPlayer.Character

ok
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
02 Mar 2013 05:05 PM
Doesn't work. It will run both at once.
Report Abuse
coplox is not online. coplox
Joined: 07 Jun 2008
Total Posts: 3252
02 Mar 2013 05:06 PM
I can think of a few hacks...

if math.random(0,1) then error("") end
Report Abuse
triston220 is not online. triston220
Joined: 08 Mar 2010
Total Posts: 1861
02 Mar 2013 05:30 PM
What about putting script.Disabled = true and the end of the script?

~~~~Need a scripter? PM me. https://twitter.com/triston220Roblo ~~~~
Report Abuse
dekkonot is not online. dekkonot
Joined: 22 Dec 2010
Total Posts: 6685
02 Mar 2013 05:42 PM
That might work, unless you had a while loop running. Then you'd run into a few problems.
Report Abuse
NINJAKID09 is not online. NINJAKID09
Joined: 27 Aug 2009
Total Posts: 14392
02 Mar 2013 06:11 PM
I've never had this problem, maybe it's the way you're coding it?
Report Abuse
NVI is not online. NVI
Joined: 11 Jan 2009
Total Posts: 4744
02 Mar 2013 10:48 PM
Nope. It's just in a ScreenGui. Go to my "smash" place, if you look carefully while online, you'll see two little cruisers being spawned.
Report Abuse
DrHaximus is not online. DrHaximus
Joined: 22 Nov 2011
Total Posts: 8410
02 Mar 2013 10:57 PM
I don't like it, it makes the page flash from the normal layout to the plugin layout. It's really disorienting.
Report Abuse
NVI is not online. NVI
Joined: 11 Jan 2009
Total Posts: 4744
02 Mar 2013 10:58 PM
I think you missed, DrHaximus. :P
Report Abuse
popinman322 is not online. popinman322
Joined: 04 Mar 2009
Total Posts: 5184
02 Mar 2013 10:58 PM
What if the blocks were the ones moving, and not the craft?
Report Abuse
NVI is not online. NVI
Joined: 11 Jan 2009
Total Posts: 4744
02 Mar 2013 10:59 PM
That might work, but I don't care enough about it to rewrite it. That still doesn't fix the problem, though, that just sidesteps it.
Report Abuse
Previous Thread :: Next Thread 
Page 1 of 1
 
 
ROBLOX Forum » Game Creation and Development » Scripters
   
 
   
  • 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