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

Button Clicked? Changing Img?

Asked by
LostPast 253 Moderation Voter
9 years ago
function changeIMG(v)
    print(v)
    if v.Image == "http://www.roblox.com/asset/?id=248530358" then
        v.Image = "http://www.roblox.com/asset/?id=248530343"
    elseif v.Image == "http://www.roblox.com/asset/?id=248530343" then
        v.Image = "http://www.roblox.com/asset/?id=248530358"
    end
end

for i,v in pairs(script.Parent:GetChildren()) do
    if v:IsA("Frame") then
        if v:FindFirstChild("CheckButton") ~= nil then
            v.CheckButton.MouseButton1Down:connect(changeIMG)
        end
    end
end

The error Comes out as:

242 15:13:04.674 - Players.Player1.PlayerGui.ScreenGui.Frame.Frame.Options.Opt:4: attempt to index local 'v' (a number value) 15:13:04.675 - Stack Begin 15:13:04.676 - Script 'Players.Player1.PlayerGui.ScreenGui.Frame.Frame.Options.Opt', Line 4 15:13:04.676 - Stack End

Answer this question