|
| 16 Nov 2014 12:04 AM |
You click the part, and you hold it down to make the Transparency 1. If you let go, the brick will have Transparency 0.
Basically, I have a simple click detector script that you click once, transparency 1, click again, transparency 0. Is there any way to make it so if you click & hold, transparency 1, let go, transparency 0.
function onClicked(playerWhoClicked) if game.Workspace.Lights.rvl.L.Enabled == false then game.Workspace.rvc.Transparency = 1 game.Workspace.Lights.rvl.L.Enabled = true else game.Workspace.rvc.Transparency = 0 game.Workspace.Lights.rvl.L.Enabled = false end end script.Parent.ClickDetector.MouseClick:connect(onClicked)
The script works, but I don't know how to make it click & hold. |
|
|
| Report Abuse |
|
|
|
| 16 Nov 2014 12:13 AM |
function onUp() game.Workspace.rvc.Transparency = 0 game.Workspace.Lights.rvl.L.Enabled = false end
function onClicked() game.Workspace.rvc.Transparency = 1 game.Workspace.Lights.rvl.L.Enabled = true end
script.Parent.ClickDetector.MouseClick:connect(onClicked) script.Parent.ClickDetector.mouse.Button1Up:connect(onUp)
Tell me if that works, thanks :) |
|
|
| Report Abuse |
|
|
|
| 16 Nov 2014 12:16 AM |
If that doesn't work, try:
function onUp() game.Workspace.rvc.Transparency = 0 game.Workspace.Lights.rvl.L.Enabled = false end
function onClicked() game.Workspace.rvc.Transparency = 1 game.Workspace.Lights.rvl.L.Enabled = true end
script.Parent.ClickDetector.MouseClick:connect(onClicked) script.Parent.ClickDetector.MouseUp:connect(onUp) |
|
|
| Report Abuse |
|
|
|
| 16 Nov 2014 12:25 AM |
| "MouseUp is not a valid member of ClickDetector" |
|
|
| Report Abuse |
|
|
|
| 16 Nov 2014 01:29 AM |
Change MouseClick to MouseButton1Down. Change MouseUp to MouseButton1Up. |
|
|
| Report Abuse |
|
|
|
| 16 Nov 2014 03:17 PM |
| MouseButton1Down is not a valid member of ClickDetector. |
|
|
| Report Abuse |
|
|
| |
|
| |
|
| |
|
| |
|
|
| 16 Nov 2014 05:15 PM |
| ClickDetectors don't have a release event I think |
|
|
| Report Abuse |
|
|
|
| 16 Nov 2014 05:22 PM |
local script in startergui
local targeting = "" --Name of the brick in workspace local mouse = game.Players.LocalPlayer:GetMouse() local down = false
mouse.Button1Down:connect(function() down = true end)
mouse.Button1Up:connect(function() down = false end)
while true do wait() if down == true then if mouse.Target == game.Workspace:WaitForChild(targeting) then for i = 0,1,.1 do mouse.Target.Transparency = i wait() end end elseif down == false and mouse.Target == game.Workspace:WaitForChild(targeting) then game.Workspace:WaitForChild(targeting).Transparency = 0 end end
Didn't write in studio. The targeting variable is the brick in Workspace. |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2014 12:28 AM |
| It's not a Gui, it's a brick e.e, and it could be more efficient without dat loop. |
|
|
| Report Abuse |
|
|
|
| 17 Nov 2014 10:20 AM |
| Happy, this functions correctly. But goes in the StarterGui. Obviously I'm more advanced then chu c: |
|
|
| Report Abuse |
|
|