when i move my mouse on the image its “not clickable” but when i click i got wanna buy… button so that works
Your mouse icon changing when hovering over an object is usually only with ClickDetectors but you can script the functionality manually.
You can use UserInputService to detect moving your mouse (or constantly check using RunService) and check if your mouse is hovering over let’s say an instance tagged as “Clickable” using the CollectionService and change the mouse icon.
i’m bad scripter, do i have to add new script? or just change the old one?
Not gonna lie if you wanna be lazy you can just convert the code to accommodate for click detectors, as they can both detect clicks and have a property that allows you to change there mouse icon lol.
Put a LocalScript under StarterPlayerScripts and put in this.
local RunService = game:GetService("RunService")
local CollectionService = game:GetService("CollectionService")
local Player = game:GetService("Players").LocalPlayer
local Mouse = Player:GetMouse()
RunService.RenderStepped:Connect(function()
local MouseTarget = Mouse.Target -- Mouse.Target is the instance your mouse is over
if MouseTarget then
if CollectionService:HasTag(MouseTarget, "Clickable") then -- Checks if MouseTarget has the Clickable tag
Mouse.Icon = "rbxassetid://" -- Put the id of your mouse icon here
end
end
end)
Use the Tag Editor to add tags to instances.
You also want to add an else
condition to change it back when not hovering.
As much as I despise ClickDetectors I’d actually advocate for them in this scenario if a custom cursor is what you want, although that would only show the change on PC.
ProximityPrompts would be a good way to do it, but again it might not be what you want.
Yeah I forgot. But like mentioned you should probably stick to ClickDetectors with this.
Put the SurfaceGui in StarterGui then put its Adornee property to the part in Workspace you want it to show on. The script you originally had will work with this.
where to see mouse id, i need to change right?
Honestly just use click detectors at this point because they are simpler and don’t require to do much for the mouse thing lol
it works but it didn’t show its clickable
i put a click detector under the image button and it didn’t work but don’t wory i can just let it how it is
If you use a ClickDetector for the part you can delete the script I sent you and make your own click detection code.
Yes, click detectors only work on instances. Also if you wanted to detect click it would just be
ClickDetector.MouseClick:Connect(function(player)
—stuff
end)
You can’t use Marketplace Service in local scripts.
Instead use a remote event with the gamepass id’s and prompt them via a server side script.
You actually can (at least on the prompt side of things), that wasn’t the issue here.
Oh, alright. I had a similar issue with client sided GUI’s so I thought it was the problem.