Recently I have been working on a Horror game with item collecting mechanics. I’ve tried multiple times on creating a part that when a mouse is hovered over it, the mouse gets bigger. Can someone help me with this?
GuiObject | Documentation - Roblox Creator Hub use this and when it fires change the texture of the mouse to what ur going for it has everything your looking for
That is only for gui objects. 30 chars.
didnt read it right! sorry
** 30!chars**
You can check if a part is being hovered over like so:
--LocalScript
player = game.Players.LocalPlayer
mouse = player:GetMouse()
DesiredPart = workspace.EnlargePart --part you want check for being hovered over
game.RunService.RenderStepped:Connect(function() --loop that checks every time screen is rendered
Hovering = false --variable to keep track of if the mouse is hovering over DesiredPart
if mouse.Target == DesiredPart then --check if the .Target of the mouse equals DesiredPart
Hovering = true
end
if Hovering == true then
--make mouse big
else
--make mouse small
end
end)
Now the hard part, is scaling the mouse. Unfortunately it is impossible to modify roblox’s default mouse size. However, you can hide the cursor, and replace it with a fake ImageLabel icon, that follows the position of the mouse.
Disable the mouse using UserInputService:
game:GetService("UserInputService").MouseIconEnabled = false --Disables the mouse icon.
Make an ImageLabel follow the mouse:
player = game.Players.LocalPlayer
mouse = player:GetMouse()
game.RunService.RenderStepped:Connect(function()
FakeMouseImageLabel.Position = UDim2.new(0,Mouse.X,0,Mouse.Y) --set position of fake, to be equivalent to the position of the real mouse, that is now invisible
end)
Now to edit the image label cursor mouse size, you can just edit it’s Size property to your liking inside the mouse hover detector code at the top of this post.
Hope my examples are helpful!
How would I make the fake mouse enlarge when hovered over a part?
He said examples, we don’t spoon feed here. You have to work that out yourself.
I am unclear of how to do that though. I have recently searched all over for a solution, but came back with nothing.
Use TweenSize and resize the fake cursor to what you want it to be when item is hovered over then copy that size under the size property then CTRL + Z it so it goes back to regular size then use TweenSize to tween it from the copied size and regular size.
But how would the script know if the fake mouse was hovered over?
That’s at the top of the answer you marked as the solution.
Like @BanTech said, look at the answer or click this link to go to the answer: Mouse Bigger on Part Hover - #6 by ExcessEnergy
When mobile player’s join the game, they don’t have a mouse. Therefore you need to create a fake mouse. You have to use logic to let the script know if the fake mouse is hovering over a part and I am unsure about how to do that.
I know a way to tell if the localPlayer is on mobile or not, I will have to find out what it is, hang on.
I already know how to do that. That’s not what I am looking for. I want to know how to let a script know if an ImageLabel is hovering over a part from a 3D view.
Why do you need this logic at all on mobiles. You can’t hover with touch and if you could the user’s finger would be in the way of your mouse icon anyway so resizing wouldn’t help. There’s not much purpose in creating a fake mouse on mobile.
What do you mean by 3D view?
I made a button that clones the tool into the players backpack. I basically want the gui to appear once the ImageLabel (fake mouse) is hovering over a part.
For example, how Mouse.Target gets the 3D position of the mouse instead of the 2D position of the mouse.
Sorry, I don’t understand that lol.