Hello all, recently I developed a script that when a players mouse goes over a NPC a gui appears using tweening ect. The gui then displays "Press F to open the store". This has all been scripted so when the "f" key is pressed the visibility of the store gui is set to true. And goes as following . However upon pressing the F key nothing happens, could I please have some help?
local uis = game:GetService("UserInputService")
local raus,vaus
local StoreGui = game.StarterGui.Store.StoreGui
local settings = {
key = "e"
}
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
while true do
if mouse.Target ~= nil and mouse.Target.Parent:FindFirstChild("HumanoidRootPart") and not game.Players:FindFirstChild(mouse.Target.Parent.Name) then
print("Works")
if mouse.Target.Position.X - player.Character.HumanoidRootPart.Position.X < 10 and mouse.Target.Position.Z - player.Character.HumanoidRootPart.Position.Z < 10 then
print("works2")
script.Parent.Frame:TweenPosition(UDim2.new(0.12 , 0 ,0.1 , 0) , "Out" , "Linear" , 0.5)
else
script.Parent.Frame:TweenPosition(UDim2.new(0.12 , 0 ,1 , 0) , "In" , "Linear" , 0.5)
end
else
script.Parent.Frame:TweenPosition(UDim2.new(0.12 , 0 ,1 , 0) , "In" , "Linear" , 0.5)
end
wait()
end
local input = uis.InputBegan.connect(function(key,gpe)
if key.KeyCode == Enum.KeyCode[string.upper(settings.key)] and vaus ~= true then
StoreGui.visible = true
end
end)

5 comments
first of all its E
yes the key is "E" not "e"
Plus, the question title doesn't fit the key you're trying to press
You are trying to press "F" and not "E", correct?
Yes it’s meant to be E, my mistake. Also in the script if you looked at line 30 it sets it to upper case.