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

gui.MouseLeave won't fire when coming out the left side?

Asked by 6 years ago
Edited 6 years ago

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 ]------------
0
You might have something else with a higher Zindex so overlaps. BlackOrange3343 2676 — 6y
0
This is the only GUI in my game. Gem_API 0 — 6y
0
But how would that matter? If something overlaps it, it wouldn't work at all. Gem_API 0 — 6y
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 User#17685 0 — 6y
View all comments (2 more)
0
What do you mean? Gem_API 0 — 6y
0
If this is the only frame in my game, how is it overlapped? it's not near a chat box or anything Gem_API 0 — 6y

Answer this question