Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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.

1 comment

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

This discussion is preserved as it was. New answers, comments, and votes are closed.