I made a weapons manager, and when you enter the weapon box you can scroll through weapons. When you leave, you are not allowed to do this. This works on all sides of the Frame, except for the left side. So is this a Roblox bug?

Code: (Focusing on the "Hand Selection")

--[[
	TITLE:			WEAPONS_MANAGER
	AUTHOR:			GEM_API
	CREATED:		6/11/18
--]]
--------------[ VARIABLES ]-------
local player = game:GetService("Players").LocalPlayer
local mouse = player:GetMouse()
local gui = player.PlayerGui:WaitForChild("WeaponSelectionGui")
local changing = false

local handWeapons = {"Unarmed", "Hands"}
local lightWeapons = {"Pistol", "Combat Pistol", "Silenced Pistol"}
local heavyWeapons = {"Assault Rifle", "Machine Gun"}
local specialWeapons = {"Rocket Launcher", "Railgun"}

local selectionHand = 1

local maxSelection
--------------[ FUNCTIONS ]------
function changeSelection(slot, text)
	slot.TextLabel.Text = text
end
--------------[ STARTUP ]---------
gui.Hand.MouseEnter:Connect(function()
	print(2)
	changing = true
end)
gui.Hand.MouseLeave:Connect(function()
	print(1)
	changing = false
end)

mouse.WheelForward:connect(function()
	if changing == true then
		maxSelection = #handWeapons
		if maxSelection > 1 then
			selectionHand = selectionHand+1
			if selectionHand > maxSelection then
				selectionHand = 1
			end
			changeSelection(gui.Hand, handWeapons[selectionHand])
		end
	end
end)
--------------[ LOOPS ]------------

6 comments

0

You might have something else with a higher Zindex so overlaps.

0

This is the only GUI in my game.

0

But how would that matter? If something overlaps it, it wouldn't work at all.

0

Check GUI Size, or you can probably check cursor if it leaves the frame if GUI and Frame have different sizes which could really affects your script

0

What do you mean?

0

If this is the only frame in my game, how is it overlapped? it's not near a chat box or anything