Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Can someone help fix this image-saving script?

Asked by 9 years ago

The script is currently disabled, but when a card pack is opened, it is enabled. When a card pack is opened, this frame slides into the center of the screen and shows the cards that came out of the pack (in a different script). For some reason, nothing is happening when I click the button that saves the cards.

This script should work out to send the cards or images to a different frame where they can be viewed.

The output says six times, "attempt to call a nil value," six is the number of cards that are presented when a pack is opened.

Can someone help me figure this out?

a = script.Parent.Parent.Parent.CardBackground1.Card1
b = script.Parent.Parent.Parent.CardBackground2.Card2
c = script.Parent.Parent.Parent.CardBackground3.Card3
d = script.Parent.Parent.Parent.CardBackground4.Card4
e = script.Parent.Parent.Parent.CardBackground5.Card5
f = script.Parent.Parent.Parent.CardBackground6.Card6

if a == "" then
    function onButtonClick1()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card1.Image = a.Image
        wait(0.001)
        a.Image = "http://www.roblox.com/asset/?id=272990969"
    end
end
script.Parent.MouseButton1Click:connect(onButtonClick1)

if b == "" then
    function onButtonClick2()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card2.Image = b.Image
        wait(0.001)
        b.Image = "http://www.roblox.com/asset/?id=272990969"
    end
end
script.Parent.MouseButton1Click:connect(onButtonClick2)

if c == "" then
    function onButtonClick3()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card3.Image = c.Image
        wait(0.001)
        c.Image = "http://www.roblox.com/asset/?id=272990969"
    end
end
script.Parent.MouseButton1Click:connect(onButtonClick3)

if d == "" then
    function onButtonClick4()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card4.Image = d.Image
        wait(0.001)
        d.Image = "http://www.roblox.com/asset/?id=272990969"
    end
end
script.Parent.MouseButton1Click:connect(onButtonClick4)

if e == "" then
    function onButtonClick5()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card5.Image = e.Image
        wait(0.001)
        e.Image = "http://www.roblox.com/asset/?id=272990969"
    end
end
script.Parent.MouseButton1Click:connect(onButtonClick5)

if f == "" then
    function onButtonClick6()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card6.Image = f.Image
        wait(0.001)
        f.Image = "http://www.roblox.com/asset/?id=272990969"
        script.Parent.Parent.Parent:TweenPosition(UDim2.new(-0.6,0,0.275,0))
        script.Parent.Parent.Parent.Parent.PacksMenu:TweenPosition(UDim2.new(0.2,0,0.275,0))
        script.Parent.Parent.Parent.Parent.TitleFrame.Title.Text = "Packs"
    end
end
script.Parent.MouseButton1Click:connect(onButtonClick6)

1 answer

Log in to vote
0
Answered by
Nickoakz 231 Moderation Voter
9 years ago

cough. pls research coding a little more next time..

a = script.Parent.Parent.Parent.CardBackground1.Card1
b = script.Parent.Parent.Parent.CardBackground2.Card2
c = script.Parent.Parent.Parent.CardBackground3.Card3
d = script.Parent.Parent.Parent.CardBackground4.Card4
e = script.Parent.Parent.Parent.CardBackground5.Card5
f = script.Parent.Parent.Parent.CardBackground6.Card6

if a ~= nil then
    script.Parent.MouseButton1Click:connect(function()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card1.Image = a.Image
        wait(0.001)
        a.Image = "http://www.roblox.com/asset/?id=272990969"
    end
end

if b~= nil  then
    script.Parent.MouseButton1Click:connect(function()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card2.Image = b.Image
        wait(0.001)
        b.Image = "http://www.roblox.com/asset/?id=272990969"
    end
end

if ~= nil then
    script.Parent.MouseButton1Click:connect(function()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card3.Image = c.Image
        wait(0.001)
        c.Image = "http://www.roblox.com/asset/?id=272990969"
    end
end

if d~= nil  then
   script.Parent.MouseButton1Click:connect(function()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card4.Image = d.Image
        wait(0.001)
        d.Image = "http://www.roblox.com/asset/?id=272990969"
    end
end

if e ~= nil then
    script.Parent.MouseButton1Click:connect(function()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card5.Image = e.Image
        wait(0.001)
        e.Image = "http://www.roblox.com/asset/?id=272990969"
    end
end

if f~= nil  then
    script.Parent.MouseButton1Click:connect(function()
        script.Parent.Parent.Parent.Parent.MyCardsMenu.Cards.Card6.Image = f.Image
        wait(0.001)
        f.Image = "http://www.roblox.com/asset/?id=272990969"
        script.Parent.Parent.Parent:TweenPosition(UDim2.new(-0.6,0,0.275,0))
        script.Parent.Parent.Parent.Parent.PacksMenu:TweenPosition(UDim2.new(0.2,0,0.275,0))
        script.Parent.Parent.Parent.Parent.TitleFrame.Title.Text = "Packs"
    end
end

0
I appreciate you helping, but I don't appreciate that first line of yours. I fixed it anyway. This is called scriptinghelpers.org, not goresearchityourself.org. User#4422 0 — 9y
Ad

Answer this question