Left and Right frame doesnt disappear

I want to make when the player hide under the table the left frame and right frame disappear (like set visible to false)

Screenshot of player when he is not under the table


Screenshot when player is under the table:

i made this code and it doesnt change right and left frame visibility to false

local input = game:GetService("UserInputService")
local underthetableview = workspace.UnderTheTableView
local camera = game.Workspace.CurrentCamera
local LeftFrame = game.StarterGui.ScreenGui.LeftLook
local RightFrame = game.StarterGui.ScreenGui.RightLook
local tweenService = game:GetService("TweenService")
local normalcamera = workspace.cameraa
function tweenCamera(pos,tweenTime)
	tweenService:Create(camera,TweenInfo.new(tweenTime,Enum.EasingStyle.Sine), {CFrame = pos.CFrame}):Play()
end


input.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.S then
		tweenCamera(underthetableview, 0.3)
		wait(0.3)
		LeftFrame.Visible = false
		RightFrame.Visible = false
	end	
end)

Have you tried printing right after?

if input.KeyCode == Enum.KeyCode.S then

so i found the solution of this problem basically i just needed to type

local LeftFrame = script.Parent.LeftLook
local RightFrame = script.Parent.RightLook

instead of

local LeftFrame = game.StarterGui.ScreenGui.LeftLook
local RightFrame = game.StarterGui.ScreenGui.RightLook

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.