Value doesn't set to false

I really tried everything i know of and all your suggestions but nothing. Its very weird

yes. whole script is above “if chatting == true then”. i’ve also tried adding “elseif chatting == fasle then” or "chatting = false, under “if Open.Value == true then” but nothing

Are you looping it or is it just running once?

it’s not looping, there’s no “while true do”

That could be why since the script runs once and never runs ever again try this code

Open.Changed:Connect()
if Humanoid and HMR then
			if Open.Value == false then
				camera.CameraType = Enum.CameraType.Scriptable
				TS:Create(camera, TweenInfo.new(1), {CFrame = HMR.CFrame * CFrame.new(0, 1.5, -4) * CFrame.Angles(0, math.pi, 0)}):Play()	
				Open.Value = true
				end
           elseif Open.Value == true then 
				camera.CameraType = Enum.CameraType.Custom
				Open.Value = false
				print("Value is false")
			end
		end
end)

sadly your didn’t work. I still don’t know why.

Try placeing the entire thing in a while wait() loop

should I put while wait() do above “if chatting == true”?

While wait() do will automatically wait so you don’t need too.

btw is it possible that you can give the whole script?

local player = game:GetService("Players")
local uis = game:GetService("UserInputService")

local detectedNPC = nil
local Detected = false
local Chatting = false
local skip = false
local Exit = false

local Player = player.LocalPlayer
local camera = game.Workspace.CurrentCamera

local gui = script.Parent
local Sound = gui.Sounds
local EButton = gui.ButtonFrame
local TalkFrame = gui.TalkFrame

local Character = Player.Character or Player.CharacterAdded:Wait()
local CharRMR = Character:WaitForChild("HumanoidRootPart")

local NPCS = game.Workspace:WaitForChild("NPCS")

local TS = game:GetService("TweenService")

local Open = script.Parent.Parent.Open


uis.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.Y then
		if Chatting == true then
			skip = true
			Sound.swipe:Play()
		end
	end
end)

uis.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.X then
		if Chatting == true then
			Exit = true
			Sound.swipe:Play()
		end
	end
end)

uis.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.E then
		
		
		if Detected == true then
			local Lines = detectedNPC:FindFirstChild("Lines")
			
			if Lines then
				Sound.swipe:Play()
				
				Chatting = true
				Detected = false
				
				TalkFrame.Frame.Dialogue.Text = " "
				
				EButton:TweenSize(UDim2.new(0, 0,0, 0),"Out","Quint", 0.3)
				TalkFrame:TweenPosition(UDim2.new(0.356,0,0.706,0),"Out","Sine", 0.5)
				
				wait(0.5)
				
				for i, Line in pairs(Lines:GetChildren()) do
					local Text = Line.Value
					
					for i = 1, #Text do
						TalkFrame.Frame.Dialogue.Text = string.sub(Text, 1, i)
						Sound.Typing:Play()
						if skip == true then
							skip = false
							TalkFrame.Frame.Dialogue.Text = Text
							break
						end
						if Exit == true then
							break
						end
						wait(0.01)
					end
					if Exit == true then
						Exit = false
						break
					end
					repeat wait() until skip == true or Exit == true
					skip = false
				end
				
				Exit = false
				skip = false
				
				EButton:TweenSize(UDim2.new(0, 0,0, 0),"Out","Quint", 0.3)
				TalkFrame:TweenPosition(UDim2.new(0.356,0,3,0),"Out","Sine", 0.5)
				
				wait(0.5)
				
				Chatting = false
				Detected = false
			end
		end
	end
end)


runService.RenderStepped:Connect(function()
	
	
	if Detected == false and Chatting == false then
		for i, NPc in pairs (NPCS:GetChildren()) do
			local Humanoid = NPc:FindFirstChild("Humanoid")
			local HMR = NPc:FindFirstChild("HumanoidRootPart")
			
			if Humanoid and HMR then
				if (HMR.Position - CharRMR.Position).magnitude < 15 then
					Detected = true
					detectedNPC = NPc
					EButton:TweenSize(UDim2.new(0.064, 0,0.114, 0),"Out","Quint", 0.3)
					print(detectedNPC.Name)
			    end
		     end
	     end
	end
	
	if Detected == true and Chatting == false then
		local Humanoid = detectedNPC:FindFirstChild("Humanoid")
		local HMR = detectedNPC:FindFirstChild("HumanoidRootPart")

		if Humanoid and HMR then
			if (HMR.Position - CharRMR.Position).magnitude > 15 then
				Detected = false
				detectedNPC = nil
				EButton:TweenSize(UDim2.new(0, 0,0, 0),"Out","Quint", 0.3)
				print("No NPC near you")
			else
				local WTSP = camera:WorldToScreenPoint(HMR.Position)
				EButton.Position = UDim2.new(0, WTSP.X, 0, WTSP.Y)
			end
		end
	end
	
	if Chatting == true then
		local Humanoid = detectedNPC:FindFirstChild("Humanoid")
		local HMR = detectedNPC:FindFirstChild("HumanoidRootPart")
		
while wait() do
if Humanoid and HMR then
			if Open.Value == false then
				camera.CameraType = Enum.CameraType.Scriptable
				TS:Create(camera, TweenInfo.new(2,Enum.EasingStyle.Quad,Enum.EasingDirection.InOut), {CFrame = HMR.CFrame * CFrame.new(0, 1.5, -4) * CFrame.Angles(0, math.pi, 0)}):Play()	
				Open.Value = true
				end
           elseif Open.Value == true then 
				camera.CameraType = Enum.CameraType.Custom
				Open.Value = false
				print("Value is false")
			end
		end
    end
end)

its not fully formatted can you fully format it?

Here you go, whole script is above you.

ok now does the while wait() do solution work for you?

while wait() do solution didn’t work, basically nothing worked.

wait nvm the while wait() do is not needed as it run every frame

only problem i have is that Value doesn’t changes to false no matter what.

try going into server mode and change the value

what’s the point of that, if people are going to play it. Value needs to change itself

Just to see if the value was changed on the server if the script would run