playbutton = script.Parent mainmenu = script.Parent.Parent loadingscreen = script.Parent.Parent.Parent.loading playbutton.Text = "Play" local cam = workspace.CurrentCamera function onClicked() while true do loadingscreen.Position = loadingscreen.Position-UDim2.new(0.03,0,0,0) wait() end end if loadingscreen.Postion(0,0,0,0) == true then cam.CameraType = "Custom" end playbutton.MouseButton1Down:connect(onClicked)
Is there something wrong in this script, it doesnt works.
Just use the Tween function. Here's a link to more info about it.
local cam = workspace.CurrentCamera local playbutton = script.Parent local mainmenu = playbutton.Parent local loadingscreen = mainmenu.Parent:WaitForChild("loading") -- ^^ added WaitForChild playbutton.Text = "Play" function onClicked() loadingscreen:TweenPosition(UDim2.new(),"In","Linear",2) wait(2) cam.CameraType = "Custom" end playbutton.MouseButton1Down:Connect(onClicked)
Also, even if you did your if statement correctly it wouldn't have worked because the if statement only runs once. The correct way of writing your particular if statement it written below.
if loadingscreen.Position == UDim2.new(0,0,0,0) then cam.CameraType = "Custom" end -->or if loadingscreen.Position == UDim2.new() then cam.CameraType = "Custom" end
Good Luck!