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

Ui not tweening out yet the print prints after the not-working tween out?

local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer


local open = script.Parent.Parent:WaitForChild("Open")
local closed = script.Parent.Parent:WaitForChild("Closed")


script.Parent.MouseButton1Click:Connect(function(plr)
	if script.Parent.Parent.Closed.Value == true then
		local menu = script.Parent.Parent.Menu
		closed.Value = false
	    open.Value = true
		menu:TweenPosition(UDim2.new({0.017, 0},{0.051, 0}),"Out","Quint",1,true)
	
	else script.Parent.Parent.Closed.Value = false 
		local menu = script.Parent.Parent.Menu
		closed.Value = true
		open.Value = false
		menu:TweenPosition(UDim2.new({-1, 0},{0, 0}),"Out","Quint",1,true)
print ("what's wrong!?")
	end
end)

so this tweens it in from the left side, changes the bools' value, prints the print but doesn't tween it away again?! tips pls?

1 comment

0

Just replace 'else script.Parent.Parent.Closed.Value = false' with else

1 answer

as i see your script, i think that you must have misspelling else statement and you define 2 same variable

local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer --This is what you've been defined


local open = script.Parent.Parent:WaitForChild("Open")
local closed = script.Parent.Parent:WaitForChild("Closed")


script.Parent.MouseButton1Click:Connect(function(plr) --And you call the parameter plr again
    if script.Parent.Parent.Closed.Value == true then
        local menu = script.Parent.Parent.Menu
        closed.Value = false
        open.Value = true
        menu:TweenPosition(UDim2.new({0.017, 0},{0.051, 0}),"Out","Quint",1,true)

    else script.Parent.Parent.Closed.Value = false -- You should use elseif  script.Parent.Parent.Closed.Value == false then, instead
        local menu = script.Parent.Parent.Menu
        closed.Value = true
        open.Value = false
        menu:TweenPosition(UDim2.new({-1, 0},{0, 0}),"Out","Quint",1,true)
print ("what's wrong!?")
    end
end)

this should be the right code

local plrs = game:GetService("Players")
local plr = plrs.LocalPlayer


local open = script.Parent.Parent:WaitForChild("Open")
local closed = script.Parent.Parent:WaitForChild("Closed")


script.Parent.MouseButton1Click:Connect(function()
    if script.Parent.Parent.Closed.Value == true then
        local menu = script.Parent.Parent.Menu
        closed.Value = false
        open.Value = true
        menu:TweenPosition(UDim2.new({0.017, 0},{0.051, 0}),"Out","Quint",1,true)

    elseif script.Parent.Parent.Closed.Value == false then
        local menu = script.Parent.Parent.Menu
        closed.Value = true
        open.Value = false
        menu:TweenPosition(UDim2.new({-1, 0},{0, 0}),"Out","Quint",1,true)
print ("what's wrong!?")
    end
end)

lemme know if this script works

2 comments

0

That elseif line is useless, in a bool value, there is only two possibilites. So, just keeping else will work.

0

actually, i've tried all tht even BEFORE i posted my question, it just won't tween the ui away again! the values work , the print does, just not the tween. that's why i am confused

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