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: Why doesn't this clone?

Previous Thread :: Next Thread 
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
19 Jul 2012 08:47 PM
if game.Workspace.GotScroll.Value == 0 then
gui = started
end
if game.Workspace.GotScroll.Value == 1 then
gui = fail
end
if game.Workspace.GotScroll.Value == 2 then
gui = win
end

script.Parent.ClickDetector.MouseClick:connect(function(player)
local idk = game.Lighting.gui.Clone() -- in this line, if say GotScroll.Value = 0 then it should clone in "started"
idk.Parent = player.PlayerGui
end)

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 05:27 AM
bump. No output. Should I use elseif so it knows the others can't be true?

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
TINISH0TZ is not online. TINISH0TZ
Joined: 20 Nov 2009
Total Posts: 2549
20 Jul 2012 05:29 AM
local idk = game.Lighting.gui:Clone()

Replace the fullstop with a Colon because it is an action.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 05:31 AM
Oh right. I make a lot of little errors.

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 05:39 AM
Yeah... It still doesn't work.

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 05:39 AM
I don't think it should be local.

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 05:46 AM
What I have so far:

if game.Workspace.GotScroll.Value == 0 then
gui = started
end
if game.Workspace.GotScroll.Value == 1 then
gui = fail
end
if game.Workspace.GotScroll.Value == 2 then
gui = win
end

script.Parent.ClickDetector.MouseClick:connect(function(player)
idk = game.Lighting.gui:Clone()
idk.Parent = player.PlayerGui
end)

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
20 Jul 2012 05:52 AM
script.Parent.ClickDetector.MouseClick:connect(function(player)

~
a ClickDetector doesn't return any values, my brother.
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 05:57 AM
How else could I make this script then? Perhaps: then repeats as much as a need. Or would that not work?

if game.Workspace.GotScroll.Value == 0 then
script.Parent.ClickDetector.MouseClick:connect(function(player)
local idk = game.Lighting.Started:Clone()
idk.Parent = player.PlayerGui
end)

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
20 Jul 2012 05:58 AM
I'm not 100% sure this is what you're attempting, so here's my best guess:

local GotScroll = game.Workspace.GotScroll -- I always store a variable so exploiters or mistakes don't break it as easily
if GotScroll.Value == 0 then
gui = "started" -- Assuming you're wanting the variable `gui` to be the name of the gui.
elseif GotScroll.Value == 1 then -- Always use an elseif in this situation. It's more efficient and takes less typing
gui = "fail"
elseif game.Workspace.GotScroll.Value == 2 then
gui = "win"
end

script.Parent.ClickDetector.MouseClick:connect(function(player)
local idk = game.Lighting[gui]:Clone() -- Local variables are faster to index. Note this line could error
idk.Parent = player.PlayerGui
end)

@master: MouseClick return the player who clicked the ClickDetector.
http://wiki.roblox.com/index.php/MouseClick_%28Event%29
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 06:04 AM
That might work... and yeah I think that's right with what I'm doing.

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
20 Jul 2012 06:06 AM
@Scar
that's new!
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 06:11 AM
The line you said may not work worked. How ever... when I stepped on the value changer (or the scroll) it did not clone the new one.

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
20 Jul 2012 06:11 AM
@lord: Personally I'd suggest indexing everything in a variable. It helps for a failsafe if something doesn't happen like you want. (Forgive any typos, I"m using an extremely small screen)

local stafted = game.Lighting:FIndFirstChild("started")
local fail = game.Lighting:FindFirstChild("fail")
local win = game.Lighting:FindFirstChild("win")

if game.Workspace.GotScroll.Value == 0 then
gui = started
elseif game.Workspace.GotScroll.Value == 1 then
gui = fail
elseif game.Workspace.GotScroll.Value == 2 then
gui = win
end

script.Parent.ClickDetector.MouseClick:connect(function(player)
local idk = gui.Clone()
idk.Parent = player.PlayerGui
end)


@Master: Actually, it's been like that for 8 months. :P
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 06:14 AM
I'll try it... By the way, I have this antihack that senses the players screen size and if it changes at all (say a DLL was injected and the screen got smaller) they get kicked.

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
20 Jul 2012 06:19 AM
Are you testling it in Play mode or Test > Play Solo?

You'll need to make sure the names of the guis in the script match the ones in lighting (otherwise it will throw an error), and you'll need to make sure they are ScreenGuis and not just a Frame or something, else they'll not render.

If it's not working, could you explain what isn't functioning as you expected or provide output? I may have just given you a faulty example as it's currently 5:00 AM and I've been up all night. :P
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 06:20 AM
I have been up all night as well. It is 7:20 on the east coast however. And by the way, it worked that once, that means the names are right. Plus output would have tole me otherwise.

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 06:23 AM
Not output. Doesn't work. I fixed the grammar errors on this line:
local stafted = game.Lighting:FIndFirstChild("started")

I don't see any others.

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 06:34 AM
Since you've been the first, and only person to have helped me progress on this so far, I would like to PM you about it later today, perhaps when you are less tired.
 
~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
MasterOfDeathOnes is not online. MasterOfDeathOnes
Joined: 21 Mar 2009
Total Posts: 6975
20 Jul 2012 06:39 AM
@scar
but it had not-been that for like 5 years!
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 06:43 AM
lol

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
Report Abuse
SCARFACIAL is not online. SCARFACIAL
Joined: 28 Jan 2010
Total Posts: 7970
20 Jul 2012 07:03 AM
Sure, you can PM me about it later if somebody who's not dsleep deprived hasn't helped by then. :P
Report Abuse
lordrambo is not online. lordrambo
Joined: 16 Jun 2009
Total Posts: 20628
20 Jul 2012 11:26 AM
Bump.

~ siggy ~ umg take my retexture http://www.roblox.com/Gold-Fish-V10-item?id=84923916 ~ siggy ~
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