Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
1

i tried to script it if i hover my Cusor over the part it glows?(probelm fixed)

Asked by 4 years ago
Edited 4 years ago

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)

0
Please make it a code block Spjureeedd 385 — 4y
0
Why do you have a while true do? And you don't have an end for it Spjureeedd 385 — 4y
0
i dont know what that means im new to this website. MadnessMyth 10 — 4y
0
Paste this before and after your code ~~~~~~~~~~~~~~~~~ and try to make it organised Spjureeedd 385 — 4y
View all comments (2 more)
0
not meant to be rude, but nothing in this script makes sense LeHelary 142 — 4y
0
answered it, hoped this helped FlabbyBoiii 81 — 4y

2 answers

Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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

0
You shouldn't use while wait do, put the wait inside the loop instead Spjureeedd 385 — 4y
Ad
Log in to vote
0
Answered by 4 years ago
Edited 4 years ago

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)

Answer this question