I got a open/close gui script from a youtube tutorial and added it to my game. I wanted to modify it by making it so that when you press a button, the gui pops up. My problem is that whenever the player moves, the gui pops up even if they don’t press the right buttons. I added my own button press script in there, but then added a button press script that somebody else made because I thought the one I made was flawed somewhere.
here’s the script (containing a script that someone else made)
local frame = script.Parent.Parent.MenuFrame
local open = false
local player = game.Players.LocalPlayer
local mouse = player:GetMouse()
local plr = game.Players.LocalPlayer
local Char = plr.Character or plr.CharacterAdded:Wait()
local UserInputService = game:GetService("UserInputService")
local Tapped = false
UserInputService.InputBegan:Connect(function(Input, GameStuff)
if GameStuff then return end
if Input.KeyCode == Enum.KeyCode.R or Enum.KeyCode.ButtonY then
if frame.Visible == false then
frame.Visible = true
end
end
end)
I don’t know how to solve this. Please help