When you press the "c" key, the camera will interpolate to the character and bring a gui up. When they press the "c" key again, the camera should interpolate back to where it was (The normal position) and the gui should go away.
However, when you press the "c" key it does all everything it's suppose to but when you press it again.. nothing happens.
What's wrong with my script?
No errors and the output stops printing at line 30.
repeat wait() until game.Players.LocalPlayer.Backpack and game.Players.LocalPlayer.StarterGear --this is just to make it work online --Variables menu = script.Parent.Main.StatsFrame --Added THE GUI MenuKey = "c" --what key to press LPlayer = game.Players.LocalPlayer --get the local player Mouse = LPlayer:GetMouse() --get the player mouse Cam = workspace.CurrentCamera --get the local camera MenuUp = false --is menu up? CameraDebounce = false --debounce --Code Mouse.KeyDown:connect(function(Key) --when a key is pressed if Key == MenuKey and not MenuUp then --if that key is c and the menu isnt up if not CameraDebounce then --if debounce is false CameraDebounce = true --debounce is now true MenuUp = true CameraDebounce = true LPlayer.Character.Humanoid.WalkSpeed = 0 Cam.CameraType = 'Scriptable' Disabled = true print'interpolating' Cam:Interpolate(CFrame.new(LPlayer.Character.Head.Position.x, LPlayer.Character.Head.Position.y, LPlayer.Character.Head.Position.z + 10), CFrame.new(LPlayer.Character.Head.Position.x + 5, LPlayer.Character.Head.Position.y, LPlayer.Character.Head.Position.z), 0.2) print'inter done' wait(0.2) CameraDebounce = false menu.Visible = true print'doing else if' elseif MenuUp and not CameraDebounce then CameraDebounce = true print'cmenu to false' MenuUp = false menu.Visible = false Cam.CameraType = 'Scriptable' Cam:Interpolate( CFrame.new(LPlayer.Character.Head.Position.x - X , LPlayer.Character.Head.Position.y + Y , LPlayer.Character.Head.Position.z + Z), CFrame.new(LPlayer.Character.Head.Position.x, LPlayer.Character.Head.Position.y , LPlayer.Character.Head.Position.z), 0.2) wait(0.2) Disabled = false Cam.CameraType = 'Scriptable' LPlayer.Character.Humanoid.WalkSpeed = 16 CameraDebounce = false end end end)