I want to make the informationframe follow the mouse whenever the mouse hovers on the template but whenever I hover over the template, the informationframe shows up for like 2 frames and then stops following the mouse, what did I do wrong? I tried changing the UDim2 in the script from offset to scale and that didn’t help
Its because you only got the mouse position once. Therefore it only runs 2 frames because that’s how long the frame overlaps the position of the mouse. Do this instead
local uis = game:GetService('UserInputService')
template.MouseEnter:Connect(function()
isintemplate = true
end)
template.MouseLeave:Connect(function()
isintemplate = false
end)
rs.Heartbeat:Connect(function()
if not isintemplate then return end
local location = uis:GetMouseLocation()
informationframe.Position = UDim2.new(0,location.X,0,location.Y)
end)
This helped but now it appears in the right position for a few frames again and then goes back down to the right. It does follow the mouse though which is good
AbsolutePosition identifies every UI to start from 0,0 from the top left of your screen giving the right position but :GetMouseLocation() for whatever reason when trying to do something with UI it starts the 0,0 on the top left of the UI so if you had a text button in the middle of the screen and top left of the frame somewhere around there then when hovering over that text button it would actually be in the middle of the 0,0 starting from the top left of the frame so it would be somewhere in the bottom right, and that is how I understand :GetMouseLocation() and AbsolutePosition.