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

How to make a if elseif script?

Asked by
NotSoNorm 777 Moderation Voter
10 years ago

Help? It keeps saying its wrong, What am I doing wrong?

if script.Parent.Parent.ScrollingFrame.Visible = true
    then script.Parent:TweenPosition()

if script.Parent.Parent.ScrollingFrame.Visible = false
    then script.Parent:TweenPosition()

    end
end

3 answers

Log in to vote
0
Answered by 10 years ago

if script.Parent.Parent.ScrollingFrame.Visible == true then script.Parent:TweenPosition() elseif script.Parent.Parent.ScrollingFrame.Visible == false then script.Parent:TweenPosition() end

Ad
Log in to vote
0
Answered by 10 years ago

Sorry if this does not work, but Studio is being blocked by a Firewall for some reason so please dont -1 me if it doesn't work.

sp=script.Parent.Parent
if sp.ScrollingFrame.Visible == true then
sp:TweenPosition()
elseif not sp.ScrollingFrame.Visible == true then --You can change the line so that it doesn't have the `not` in it, but in doing so you have to change `true` to `false` again
sp:TweenPosition()
end

-- OBOVE IS OLD --

You forgot about the if effect when doing that kind of thing, for that you have to do == or ~=, for example;

find=script.Parent:FindFirstChild("BrickThingy")
if find~=nil then -- Else if you put a single = it'll error and wont work
print("Hooray! BrickThingy exists!")
elseif not find~=nil then
print('Oh no! BrickThingy doesn't exist!")
end
Log in to vote
-1
Answered by
KAAK82 16
10 years ago
if script.Parent.Parent.ScrollingFrame.Visible = true
    then script.Parent:TweenPosition()
elseif script.Parent.Parent.ScrollingFrame.Visible = false
    then script.Parent:TweenPosition()
        end
    end
end

Answer this question