Ad
Log in to vote
0

Cloning with gui textbuttons?

Asked by 7 years ago
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.

0
Can you add the error, or at-least what the out out says. HexC3D 830 — 7y
0
Yellow try it again fixed it HexC3D 830 — 7y
0
Try again HexC3D 830 — 7y

2 answers

Log in to vote
1
Answered by
HexC3D 830 Moderation Voter
7 years ago
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

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? YellowoTide 1988 — 7y
0
I can fix it HexC3D 830 — 7y
0
Thanks kind Sir. And I see an answer by you on almost every post on this site. Good job :3 YellowoTide 1988 — 7y
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 YellowoTide 1988 — 7y
View all comments (2 more)
0
Try using lighting instead? HexC3D 830 — 7y
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? YellowoTide 1988 — 7y
Ad
Log in to vote
-2
Answered by 7 years ago

What are the plus(x) variables? Parts?

0
They are text labels :) YellowoTide 1988 — 7y

Answer this question