I need to click a number 2 times for it to work ex. I click 2 1 time and it doesn't do anything. When i click 2 2 times it selects 2.

Warning!(Long piece of code up ahead)

scroll down to see








'
uis = game:GetService("UserInputService")
plr = game.Players.LocalPlayer
ctr = plr.Character or plr.CharacterAdded:Wait()

uis.InputBegan:Connect(function(key, process)
	if process == false then
		if key.KeyCode == Enum.KeyCode.One then
			if plr.Moves.move1.Value ~= "None" then
				if plr.Backpack:FindFirstChild(plr.Moves.move1.Value) == nil then
					ctr:WaitForChild("Humanoid"):UnequipTools()
					plr.PlayerGui.Moves.Frame.Move1.Text = plr.Moves.move1.Value
				else
					ctr:WaitForChild("Humanoid"):EquipTool(plr.Backpack[plr.Moves.move1.Value])
					lol = plr.Moves.move1.Value
					plr.PlayerGui.Moves.Frame.Move1.Text = ">"..lol
					for i = 1, 5 do
						if i ~= 1 then
							plr.PlayerGui.Moves.Frame["Move"..i].Text = plr.Moves["move"..i].Value
						end
					end
				end
			end
		elseif key.KeyCode == Enum.KeyCode.Two then
			if plr.Moves.move2.Value ~= "None" then
				if plr.Backpack:FindFirstChild(plr.Moves.move2.Value) == nil then
					ctr:WaitForChild("Humanoid"):UnequipTools()
					plr.PlayerGui.Moves.Frame.Move2.Text = plr.Backpack[plr.Moves.move2.Value]
				else
					ctr:WaitForChild("Humanoid"):EquipTool(plr.Backpack[plr.Moves.move2.Value])
					lol = plr.Moves.move2.Value
					plr.PlayerGui.Moves.Frame.Move2.Text = ">"..lol
					for i = 1, 5 do
						if i ~= 2 then
							plr.PlayerGui.Moves.Frame["Move"..i].Text = plr.Moves["move"..i].Value
						end
					end
				end
			end
		elseif key.KeyCode == Enum.KeyCode.Three then
			if plr.Moves.move3.Value ~= "None" then
				if plr.Backpack:FindFirstChild(plr.Moves.move3.Value) == nil then
					ctr:WaitForChild("Humanoid"):UnequipTools()
					plr.PlayerGui.Moves.Frame.Move3.Text = plr.Backpack[plr.Moves.move3.Value]
				else
					ctr:WaitForChild("Humanoid"):EquipTool(plr.Backpack[plr.Moves.move3.Value])
					lol = plr.Moves.move3.Value
					plr.PlayerGui.Moves.Frame.Move3.Text = ">"..lol
					for i = 1, 5 do
						if i ~= 3 then
							plr.PlayerGui.Moves.Frame["Move"..i].Text = plr.Moves["move"..i].Value
						end
					end
				end
			end
		elseif key.KeyCode == Enum.KeyCode.Four then
			if plr.Moves.move4.Value ~= "None" then
				if plr.Backpack:FindFirstChild(plr.Moves.move4.Value) == nil then
					ctr:WaitForChild("Humanoid"):UnequipTools()
					plr.PlayerGui.Moves.Frame.Move4.Text = plr.Backpack[plr.Moves.move4.Value]
				else
					ctr:WaitForChild("Humanoid"):EquipTool(plr.Backpack[plr.Moves.move4.Value])
					lol = plr.Moves.move4.Value
					plr.PlayerGui.Moves.Frame.Move4.Text = ">"..lol
					for i = 1, 5 do
						if i ~= 4 then
							plr.PlayerGui.Moves.Frame["Move"..i].Text = plr.Moves["move"..i].Value
						end
					end
				end
			end
		elseif key.KeyCode == Enum.KeyCode.Five then
			if plr.Moves.move5.Value ~= "None" then
				if plr.Backpack:FindFirstChild(plr.Moves.move5.Value) == nil then
					ctr:WaitForChild("Humanoid"):UnequipTools()
					plr.PlayerGui.Moves.Frame.Move5.Text = plr.Backpack[plr.Moves.move5.Value]
				else
					ctr:WaitForChild("Humanoid"):EquipTool(plr.Backpack[plr.Moves.move5.Value])
					lol = plr.Moves.move5.Value
					plr.PlayerGui.Moves.Frame.Move5.Text = ">"..lol
					for i = 1, 5 do
						if i ~= 5 then
							plr.PlayerGui.Moves.Frame["Move"..i].Text = plr.Moves["move"..i].Value
						end
					end
				end
			end
		end
	end
end)

7 comments

0

Be more specific in what the exact issue is.

0

:/

0

Alright, well my guess is that the value starts out as "none", which makes you unequip tools, then afterwards, you changed the value so that it is not "none" and will then give the player the tool on the second attempt

0

:/ IT STARTS AT NONE not nil!

0

So couldn't you make sure that the value is not "none" when you start, then make it "none" when appropriate?

0

why would i make it none?

0

And there's no error in the output? just to make sure.