Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

Cloning with gui textbuttons?

script.Parent.MouseButton1Click:connect(function(click)
	game.Workspace.cookies.Value = game.Workspace.cookies.Value + 1
	rambodoge = math.ceil(math.random(0, 5))
	if rambodoge == 1 then
		plusone = game.ServerStorage.plusone:Clone()
		plusone.Parent = script.Parent.Parent.Parent:FindFirstChild("PointPopup")
	elseif rambodoge == 2 then
		plustwo = game.ServerStorage.plustwo:Clone()
		plustwo.Parent = script.Parent.Parent.Parent:FindFirstChild("PointPopup")
	elseif rambodoge >= 3 then
		plusthree = game.ServerStorage.plusthree:Clone()
		plusthree.Parent = script.Parent.Parent.Parent:FindFirstChild("PointPopup")
	end
end)

Idk why but its an error at line 11 the output does not help.

3 comments

0

Can you add the error, or at-least what the out out says.

0

Yellow try it again fixed it

0

Try again

2 answers

✓ Accepted answer
script.Parent.MouseButton1Click:connect(function(click)
for i = 1,1 do
    game.Workspace.cookies.Value = game.Workspace.cookies.Value + 1
end
    rambodoge = math.ceil(math.random(0, 5))
    if rambodoge == 1 then
        game.Lighting.plusone:Clone().Parent = script.Parent.Parent.Parent:FindFirstChild("PointPopup")
    elseif rambodoge == 2 then
       game.Lighting.plustwo:Clone().Parent = script.Parent.Parent.Parent:FindFirstChild("PointPopup")
    elseif rambodoge == 3 then
        game.Lighting.plusthree:Clone().Parent= script.Parent.Parent.Parent:FindFirstChild("PointPopup") -- There is a limit on how many times you can use a clone and I just fixed it?
    end
end)

Try this..Also move everything to lighting.

+1 if this helped :P

6 comments

0

Helped. But did not work. Is the issue that once I click the button a second time. It would exceed the amount of clones a script can do?

0

I can fix it

0

Thanks kind Sir. And I see an answer by you on almost every post on this site. Good job :3

0

You need to remove the plusone = game.ServerStoarage.... etc for plus one and plus two. Tried bot h ways. Still didn't work. Error on line five. Not sure whats wrong

0

Try using lighting instead?

0

Kind of fixed. I'm making cookie clicker and this works untill you buy an upgrade with cookies. I'm not sure why this would happen?

What are the plus(x) variables? Parts?

1 comment

0

They are text labels :)

This discussion is preserved as it was. New answers, comments, and votes are closed.