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

GUI Toggle script doesnt scan for RightShift Input?

btw there is a value inside of the GUI so that i know if its Visible so i can spend less time lol

local UIS = game:GetService("UserInputService")

UIS.InputBegan:Connect(function(key)
	if key == Enum.KeyCode.RightShift then
		if script.Parent.Visible.Value == true then
			script.Parent.BottomFrame.Visible = false
			script.Parent.Frame.Visible = false
			
		else
			script.Parent.BottomFrame.Visible = true
			script.Parent.Frame.Visible = true
			
		end
		
	else
		return
	end
end)

2 comments

0

and yes the Value is a Bool

0

boolValues can be changed locally and globally that why its not working because for the server the value still appears as false. Replace that boolValue with a simple local Value = false and tell me if it works

1 answer

InputBegan gives “input”, not “key”, also, it’s not the KeyCode itself. You need to do Input.KeyCode to compare the keys. So something like

UIS.InputBegan:Connect(function(input)
	if input.KeyCode == Enum.KeyCode.RightShift then
		--yes shift
	else
		--no shift
	end
end)

2 comments

0

it doesn't matter what you name the argument, it works either way with "input" or "key"

0

That is in fact true, I should have worded my sentence more appropriately. However “key” does not really represent what the argument is, so it is still generally advised to name it “input”.

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