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

Certain part of my script won't run and I don't know why?

Asked by 2 years ago

The part that says "if mageTween == true" wont run or something. I don't get "mage tween worked" in the output.

--true/false
local mageTween = false

--labels/buttons
local Text = script.Parent
local Logo = script.Parent.Parent.logo
local BG = script.Parent.Parent.mobileSupport
local BD = script.Parent.Parent.borderDesign 
local BD1 = script.Parent.Parent.borderDesign1
local mageFrame = script.Parent.Parent.mageFrame
local moreinfoBtnMage = script.Parent.Parent.mageFrame.moreinfoBtn

--services
local Tween = game:GetService("TweenService")
local userInputService = game:GetService("UserInputService")

--tweens
local sizeHoverMageTween = Tween:Create(mageFrame, TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Size = UDim2.new(0.169, 0,0.623, 0)})
local sizedecHoverMageTween = Tween:Create(mageFrame, TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Size = UDim2.new(0.156, 0,0.594, 0)})

--moreinfoMage
local moreinfoHoverTweenM = Tween:Create(moreinfoBtnMage, TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Size = UDim2.new(0.746, 0,0.204, 0)}) --default {0.690, 0},{0.189, 0} 
local moreinfoDecHoverTweenM = Tween:Create(moreinfoBtnMage, TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Size = UDim2.new(0.69, 0,0.189, 0)}) --hover {0.746, 0},{0.204, 0}
local moreinfoPressedTweenM= Tween:Create(moreinfoBtnMage, TweenInfo.new(0.3, Enum.EasingStyle.Back, Enum.EasingDirection.Out), {Size = UDim2.new(0.629, 0,0.172, 0)}) --pressed {0.629, 0},{0.172, 0}

--main menu
userInputService.InputBegan:Connect(function(input, gameProcessedEvent)
    if  input.KeyCode == Enum.KeyCode.Space then
        print("key worked")
        --Text.Visible = false
        BG.Visible = false
        mageTween = true

    end
end)

BG.MouseButton1Click:Connect(function() 
    print("click worked")
    --Text.Visible = false
    mageTween = true
    BG.Visible = false
    BD:TweenPosition(UDim2.new(0.411, 0,-1.654, 0),"In", "Quad",3,false)
    BD1:TweenPosition(UDim2.new(0.411, 0,-1.566, 0),"In", "Quad",3,false)
    Logo:TweenPosition(UDim2.new(0.293, 0,-1.085, 0),"In", "Quad",3,false)
    Text:TweenPosition(UDim2.new(0.411, 0,-1.612, 0),"In", "Quad",3,false)
end)

--mage selection
mageFrame.MouseEnter:Connect(function() --hover size - {0.169, 0},{0.623, 0}
    moreinfoBtnMage.Visible = true
    print("enter worked") 
    sizeHoverMageTween:Play()


end)

mageFrame.MouseLeave:Connect(function() --base size - {0.156, 0},{0.594, 0}
    moreinfoBtnMage.Visible = false
    print("leave worked")
    sizedecHoverMageTween:Play()


end)

--{0.29, 0},{0.02, 0} start
--{0.29, 0},{0.08, 0} end

--mage
if mageTween == true then
    print("mage tween worked")
    wait(3)
    mageFrame:TweenPosition(UDim2.new(0.777, 0,0.521, 0),"In", "Elastic",1,false) 
--{0.777, 0},{0.521, 0}
end

--more info
moreinfoBtnMage.MouseButton1Click:Connect(function() 
    moreinfoPressedTweenM:Play()
    wait(0.001)
    moreinfoHoverTweenM:Play()
end)

moreinfoBtnMage.MouseLeave:Connect(function()
    moreinfoDecHoverTweenM:Play()
end)

moreinfoBtnMage.MouseEnter:Connect(function()
    moreinfoHoverTweenM:Play()
end)



repeat
    Text.ImageTransparency = 0
    wait(0.05)
    Text.ImageTransparency = 0.1
    wait(0.05)
    Text.ImageTransparency = 0.2
    wait(0.05)
    Text.ImageTransparency = 0.3
    wait(0.05)
    Text.ImageTransparency = 0.4
    wait(0.05)
    Text.ImageTransparency = 0.5
    wait(0.05)
    Text.ImageTransparency = 0.6
    wait(0.05)
    Text.ImageTransparency = 0.7
    wait(0.05)
    Text.ImageTransparency = 0.8
    wait(0.05)
    Text.ImageTransparency = 0.9
    wait(0.05)
    Text.ImageTransparency = 1
    wait(0.3)
    Text.ImageTransparency = 0.9
    wait(0.05)
    Text.ImageTransparency = 0.8
    wait(0.05)
    Text.ImageTransparency = 0.7
    wait(0.05)
    Text.ImageTransparency = 0.6
    wait(0.05)
    Text.ImageTransparency = 0.5
    wait(0.05)
    Text.ImageTransparency = 0.4
    wait(0.05)
    Text.ImageTransparency = 0.3
    wait(0.05)
    Text.ImageTransparency = 0.2
    wait(0.05)
    Text.ImageTransparency = 0.1
    wait(0.3)
    print("fade worked")
until BG.Visible == false

if BG.Visible == false then
    print("bg visible worked")
end

1 answer

Log in to vote
0
Answered by 2 years ago

Nevermind, it just has to be after the transparency script!

Ad

Answer this question