You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? I want too make a gui that will pop up on the mouse when a player hovers there mouse over a button
What is the issue? I don’t know where to start
What solutions have you tried so far? I tried finding stuff on the developer hub
So I have a inventory system and I needed a way too show stats of items so I thought that making a gui appear on the players mouse when hovered over would be a good idea but I don’t know where to start on something like this.
When player hover mouse on GUIs, you would use RenderStepped so any gui (that you want to put) will update and be on the mouse. (make the gui visible true)
And then inside the RenderStepped event, update the X and Y position of the gui by using player:GetMouse X and Y.
Here is an simple example (frame is the item in the inventory and statsFrame is the frame that shows that stats of the items):
local RS = game:GetService("RunService")
local UIS = game:GetService("UserInputService")
frame.MouseEnter:Connect(function()
statsFrame.Visible = true
end)
frame.MouseLeave:Connect(function()
statsFrame.Visible = false
end)
local function renderStepped()
if statsFrame.Visible then
local mouseLoc = UIS:GetMouseLocation()
local mousePos = UDim2.fromOffset(mouseLoc.X,mouseLoc.Y)
statsFrame.Position = mousePos
end
end
RS.RenderStepped:Connect(renderStepped)