while true do local function onHoverEnter(player) script.Parent.Transparency = 0 end local function onHoverLeave(player) script.Parent.Transparency = 1 end ClickDetector.MouseHoverEnter:connect(onHoverEnter) ClickDetector.MouseHoverLeave:connect(onHoverLeave)
i tried to script it if i hover my Cusor over the part it glows?(probelm fixed)
2 answers
So i've formatted the script it into a code block for anyone who wants to answer.
while true do
local function onHoverEnter(player)
script.Parent.Transparency = 0
end
local function onHoverLeave(player)
script.Parent.Transparency = 1
end
ClickDetector.MouseHoverEnter:connect(onHoverEnter) ClickDetector.MouseHoverLeave:connect(onHoverLeave)
But here's my answer.. Basically you want to show the part when the mouse hovers over it, then make it invisible as it leaves. Sounds simple enough.
As far as i'm aware your script is pretty much spot on but it's missing some stuff.
while wait() do
local function onHoverEnter(player)
script.Parent.Transparency = 0
end
local function onHoverLeave(player)
script.Parent.Transparency = 1
end
ClickDetector.MouseHoverEnter:connect(onHoverEnter) ClickDetector.MouseHoverLeave:connect(onHoverLeave)
end
All i've done is put an end on the loop to mark the end of the loop (pretty self explanatory). I also changed while true do to while wait() do to avoid crashing.
The loop itself isn't necessary and can be removed if you wish, i dunno what you plan to do with it but the current script will run just fine without it
(if you do remove the loop remember to remove the end at the bottom as well)
Anyway hope this helped :D
1 comment
You shouldn't use while wait do, put the wait inside the loop instead
You don't need while loop to check the event is fire or not, because event( MouseHoverEnter, MouseHoverLeave ) can fire again:
local function onHoverEnter(player)
script.Parent.Transparency = 0
end
local function onHoverLeave(player)
script.Parent.Transparency = 1
end
ClickDetector.MouseHoverEnter:connect(onHoverEnter) ClickDetector.MouseHoverLeave:connect(onHoverLeave)
This discussion is preserved as it was. New answers, comments, and votes are closed.

6 comments
Please make it a code block
Why do you have a while true do? And you don't have an end for it
i dont know what that means im new to this website.
Paste this before and after your code ~~~~~~~~~~~~~~~~~ and try to make it organised
not meant to be rude, but nothing in this script makes sense
answered it, hoped this helped