So the script works but when Click my mouse or do anything it just turns the frame's Visibility to false i used print instead of visibility but every time i hit E it prints it 20 times please help! :
local PrincipleNPC = workspace.NPCS.PrincipleNPC
local Detector = workspace.PlayerDetectors.PrincipleDetector
local eToTalk = script.Parent.eToTalk
local Touching = false
local UIS = game:GetService("UserInputService")
Detector.Touched:Connect(function()
eToTalk:TweenPosition(UDim2.new(0.262, 0 ,0.771, 0),"Out","Quart",0.2)
Touching = true
UIS.InputBegan:Connect(function(input)
if Touching == true and input.KeyCode == Enum.KeyCode.E then
script.Parent.Frame.Visible = true
else
Touching = false
return
end
end)
end)
Detector.TouchEnded:Connect(function()
eToTalk:TweenPosition(UDim2.new(0.262, 0,1, 0),"In","Quart",0.2)
UIS.InputBegan:Connect(function()
if Touching == false then
script.Parent.Frame.Visible = false
Touching = false
end
end)
end)

1 comment
It seems on the Touch Ended function I put Input begin without specify the input so thats why when i do anything it stoppes the code