Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How to make a if elseif script?

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

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

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
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

This discussion is preserved as it was. New answers, comments, and votes are closed.