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

Adding Filtering Enabled to Gui?

Asked by 7 years ago

Hello, i'm wondering how to add a filtering enabled to a local script to make it work currectly. But Still giving me simple errors like : CardsMainFrame Is not valid member of frame Here is the local script :

player = game.Players.LocalPlayer
repeat wait() until player.Character
character = player.Character

local CardsAd = script.Parent.CardsMainFrame:FindFirstChild('Ad') ----------------- The Problem begins from here
local CardsMiddle = script.Parent.CardsMainFrame:FindFirstChild('Middle')
local CardsExiter = script.Parent.CardsMainFrame:FindFirstChild('CardsExiter')
local CommonCardsFrame = script.Parent.CardsMainFrame.AllRarityCards.CommonCards:FindFirstChild('AllCards')
local CardsStats = script.Parent.CardsMainFrame:FindFirstChild('CardStats')
local CardsStatsIcon = CardsStats.Middle:FindFirstChild('Icon')
local StatsBar = CardsStats.Middle.StatsBar:FindFirstChild('AllBars')


function AnimateFrameCards()
     script.Parent.CardsMainFrame.Size = UDim2.new(1, -320, 1, 480)
     script.Parent.CardsMainFrame.Position = UDim2.new(0.5, -240, 1, -720)
     script.Parent.CardsMainFrame:TweenSizeAndPosition(UDim2.new(1, -300,1, 500), UDim2.new(0.5, -250,1, -730), "Out", "Back", 0.3)
end

function onClick(mouse)--DO NOT CHANGE
    if script.Parent.SwitchButton.Rotation == 180 and script.Parent.Position == UDim2.new(0.5, -400, 1, 0)  then--Check
        script.Parent.SwitchButton.Rotation = 0
        script.Parent:TweenPosition(UDim2.new(0.5, -400, 1, -100), "Out", "Quad", 0.5)
        script.ButtonClick2.Playing = true

    else--Check not needed
        script.Parent.SwitchButton.Rotation = 180
        script.Parent:TweenPosition(UDim2.new(0.5, -400, 1, 0), "Out", "Quad", 0.5)
        script.ButtonClick2.Playing = true

     end
end

for i, slot in pairs(script.Parent.AnotherFrame:GetChildren()) do
    slot.button.MouseButton1Click:connect(function()
        local theframe = slot.TheObject
    if slot.button.Title.Visible == false and slot.button.Icon.Size == UDim2.new(0, 90, 0, 90) and theframe.Value.Visible == false then
        theframe.Value.Visible = true
        theframe.Value:TweenSizeAndPosition(UDim2.new(1, -300,1, 500), UDim2.new(0.5, -250,1, -730), "Out", "Back", 0.3)
        slot.button.Title.Visible = true
        slot.button.BackgroundColor3 = Color3.fromRGB(80, 114, 189)
        slot.button.Icon:TweenSizeAndPosition(UDim2.new(0, 60, 0, 60), UDim2.new(1, -130, 0, 5), "Out", "Back", 0.3)
        script.ButtonClick.Playing = true
    else
        theframe.Value.Visible = false  
        theframe.Value:TweenSizeAndPosition(UDim2.new(1, -320,1, 480), UDim2.new(0.5, -240,1, -720), "Out", "Back", 0.3)
        slot.button.Title.Visible = false
        slot.button.BackgroundColor3 = Color3.fromRGB(42, 63, 109)
        slot.button.Icon:TweenSizeAndPosition(UDim2.new(0, 90, 0, 90), UDim2.new(1, -140, 0, 5), "Out", "Back", 0.3)
        script.ButtonClick.Playing = true

        end
    end)
end

for i, slot2 in pairs(script.Parent.CardsMainFrame.Middle:GetChildren()) do
        slot2.MouseEnter:connect(function()
            slot2.SelectedFrame.Visible = true
        end)

    slot2.MouseButton1Click:connect(function()
        local theframe2 = slot2.TheObject
    if  theframe2.Value.Visible == false then
        theframe2.Value.Visible = true
        CardsAd.Visible = false
        CardsMiddle.Visible = false
        CardsExiter.Visible = true
        AnimateFrameCards()
        script.ButtonClick.Playing = true
    else
        theframe2.Value.Visible = false 
        CardsAd.Visible = true
        CardsMiddle.Visible = true
        CardsExiter.Visible = false
        AnimateFrameCards()
        script.ButtonClick.Playing = true

        end
    end)

    slot2.MouseLeave:connect(function()
            slot2.SelectedFrame.Visible = false
        end)
end

CardsExiter.MouseEnter:connect(function()
    CardsExiter.SelectedFrame.Visible = true
end)

CardsExiter.MouseButton1Click:connect(function()
    for i, allrarity in pairs(script.Parent.CardsMainFrame.AllRarityCards:GetChildren()) do
        allrarity.Visible = false
        CardsAd.Visible = true
        CardsMiddle.Visible = true
        CardsExiter.Visible = false
        CardsExiter.SelectedFrame.Visible = false
        script.ButtonClick.Playing = true
        AnimateFrameCards()
    end
end)

CardsExiter.MouseLeave:connect(function()
    CardsExiter.SelectedFrame.Visible = false
end)

for i, commonCards in pairs(CommonCardsFrame:GetChildren()) do
    if commonCards.ClassName == 'ImageButton' then
       commonCards.MouseButton1Click:connect(function()
    if CardsStats.Visible == false then
        CommonCardsFrame.Parent.Visible = false
        CardsStats.Visible = true
        CardsExiter.SelectedFrame.Visible = false
        CardsExiter.Visible = false
        script.ButtonClick.Playing = true
        CardsStatsIcon.Image = commonCards.Image
        StatsBar.WeaknessBar.Answer.Text = commonCards.Weakness.Value  
        StatsBar.DamageAreaBar.Answer.Text = commonCards.DamageArea.Value  
        StatsBar.DamageBar.Answer.Text = commonCards.Damage.Value  
        StatsBar.HealthBar.Answer.Text = commonCards.Health.Value  
        StatsBar.HitSpeedBar.Answer.Text = commonCards.HitSpeed.Value  
        StatsBar.RadiusBar.Answer.Text = commonCards.Radius.Value  
        StatsBar.RangeBar.Answer.Text = commonCards.Range.Value  
        StatsBar.ShieldBar.Answer.Text = commonCards.Shield.Value  
        StatsBar.SpeedBar.Answer.Text = commonCards.Speed.Value  
        StatsBar.TargetBar.Answer.Text = commonCards.Target.Value 
        AnimateFrameCards()
        end
     end)
   end
end

script.Parent.SwitchButton.MouseButton1Click:connect(onClick)

Any suggestions for fixing this script? also sorry if is it longer, i just need solution for this script.

Answer this question