Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to fix this gui open script open other key but not chosen?

Asked by
TechModel 118
3 years ago

This sounds weird in the title but what I really mean is that I want this script to be able to press T only and it opens this shop GUI with sound effect and position I added. The problem is I only want the GUI to NOT be activated when chatting, because then it gets annoying. So I did research and added some parts of the gameproccessed script but it makes it worse. So how do I make it only T opens/closes the GUI?

local UserInputService = game:GetService("UserInputService")

local FrameObject = script.Parent.Parent.Frame

local PositionClosed = UDim2.new(0.15,0,0.036, 0)
local PositionOpen = UDim2.new(0.15,0,0.078, 0)

game:GetService("UserInputService").InputBegan:Connect(function(keyCode, gameProcessed)
    if keyCode.keyCode == Enum.KeyCode.T and not gameProcessed then
            FrameObject.Visible = true
            script.Opening:Play()
            FrameObject:TweenPosition((PositionClosed),'Out','Linear',0)
            FrameObject.Visible = false
        else
            FrameObject.Visible = false
            script.Opening:Play()
            FrameObject:TweenPosition((PositionOpen),'Out','Linear',.15)
            FrameObject.Visible = true
        end
end)


1 answer

Log in to vote
0
Answered by 3 years ago

May I ask why not change it so instead of pressing T you press G or any other key that's not already set?

In my option: The people who play you game might press T for chat, and get annoyed when the shop comes up and have to press / for chat instead. They might do this with out thought and continue to press T and get more annoyed every time. Because this player might always press T in every game for chat just cause or maybe they don't know that the / button also works for chat. So

Maybe its best to have G if its a gear shop. Or P if its a pet shop. And have a GUI on the side that says what key it is to open it and they can click this other GUI too and it will open.

0
Guess you're right, but that doesn't solve the problem as if I say were typing in chat with words containing "g" same thing TechModel 118 — 3y
Ad

Answer this question