brados123
|
  |
| Joined: 24 Nov 2012 |
| Total Posts: 2143 |
|
|
| 10 Oct 2015 03:58 AM |
can i use a mouse over function instead of down for a brick with a click detector?
thanks guys |
|
|
| Report Abuse |
|
|
|
| 10 Oct 2015 04:06 AM |
It can be done, but it's not as simple as when using ClickDetectors. Be aware that the following *will* work with FE, but ClickDetectors won't.
Put the following in StarterPlayerScripts:
player = game.Players.LocalPlayer mouse = player:GetMouse()
while true do if mouse.Target ~= currentHoverTarget then if currentHoverTarget ~= nil then if currentHoverTarget:findFirstChild("HoverDetector") then currentHoverTarget.HoverDetector:FireServer(false) end end currentHoverTarget = mouse.Target else return end
if mouse.Target then if mouse.Target:findFirstChild("HoverDetector") then mouse.Target.HoverDetector:FireServer(true) end end
game:GetService("RunService").RenderStepped:wait() end
Then put a RemoteEvent instance inside every part you want to have a 'HoverDetector'. The RemoteEvents have to be called 'HoverDetector', or this wont work. To detect when the mouse enters or leaves the part, put the following in a *server* script, i.e. normal script.
part.HoverDetector.OnServerEvent:connect(function(state) if state == true then part.BrickColor = BrickColor.Red() else part.BrickColor = BrickColor.Blue() end end) |
|
|
| Report Abuse |
|
|
brados123
|
  |
| Joined: 24 Nov 2012 |
| Total Posts: 2143 |
|
|
| 10 Oct 2015 04:34 AM |
no.
I am a scripter, I just testing.
But btw, if you dont know, you could just use script.parent.--mousehover--.
Instead, its easier. thanks guys |
|
|
| Report Abuse |
|
|