UIS.InputBegan:Connect(function(B)if B.KeyCode==Enum.KeyCode.X then if Chatting==true then Skip=true Sounds.Click:Play()end end end)UIS.InputBegan:Connect(function(B)if B.KeyCode==Enum.KeyCode.Z then if Chatting==true then Exit=true Sounds.Click:Play()end end end)UIS.InputBegan:Connect(function(B)if B.KeyCode==Enum.KeyCode.E then if Detected==true then local B=DetectedNPC:FindFirstChild("\076\105\110\101\115")if B then Sounds.Click:Play()Chatting=true Detected=false LineLabel.Text=" "PromptLabel:TweenSize(UDim2.new(0,0,0,0),"\079\117\116","\076\105\110\101\097\114",.2)LineLabel:TweenPosition(UDim2.new(0,0,.8,0),"\073\110","\076\105\110\101\097\114",.2)wait(.5)for B,v in pairs(B:GetChildren())do local C=v.Value for B=1,#C,1 do LineLabel.Text=string.sub(C,1,B)Sounds.Talk:Play()if Skip==true then Skip=false LineLabel.Text=C break end if Exit==true then break end wait(.07)end if Exit==true then Exit=false break end repeat wait()until Skip==true or Exit==true Skip=false end Exit=false Skip=false PromptLabel:TweenSize(UDim2.new(0,0,0,0),"\079\117\116","\076\105\110\101\097\114",.2)LineLabel:TweenPosition(UDim2.new(0,0,1.2,0),"\079\117\116","\076\105\110\101\097\114",.2)wait(.5)Chatting=false Detected=false end end end end)



UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.X then
		if Chatting == true then
			Skip = true
			Sounds.Click:Play()
		end
	end
end)

UIS.InputBegan:Connect(function(Input)
	if Input.KeyCode == Enum.KeyCode.Z then
		if Chatting == true then
			Exit = true
			Sounds.Click: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
				Sounds.Click:Play()
				
				Chatting = true
				Detected = false
				
				LineLabel.Text = " "
				
				PromptLabel:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Linear", 0.2)
				LineLabel:TweenPosition(UDim2.new(0, 0, 0.8, 0), "In", "Linear", 0.2)
				
				wait(0.5)
				
				for i, Line in pairs(Lines:GetChildren()) do
					local Text = Line.Value
					
					for i = 1, #Text do
						LineLabel.Text = string.sub(Text, 1, i)
						Sounds.Talk:Play()
						if Skip == true then
							Skip = false
							LineLabel.Text = Text
							break
						end
						if Exit == true then
							break
						end
						wait(0.07)
					end
					if Exit == true then
						Exit = false
						break
					end
					repeat wait() until Skip == true or Exit == true
					Skip = false
				end
				
				Exit = false
				Skip = false
				
				PromptLabel:TweenSize(UDim2.new(0, 0, 0, 0), "Out", "Linear", 0.2)
				LineLabel:TweenPosition(UDim2.new(0, 0, 1.2, 0), "Out", "Linear", 0.2)
				
				wait(0.5)
				
				Chatting = false
				Detected = false
			end
		end
	end
end)


