The error and the Thumb are not appearing when i hover over the lid, My cursor also dissapears when i hover over the invisible lid, any help with that?
**What solutions have you tried so far? For now, I cannot find anything that helped me solve this problem because i have an unknown source in the error.
Here’s also the Unknown source just in case it’s important
This is a LocalScript in the StarterGUI
local detector1 = game.Workspace.Dumpster1.Lid.ClickDetector
local detector2 = game.Workspace.Dumpster1.OpenLid.ClickDetector
detector1.MouseClick:Connect(function()
game.Workspace.RemoteEvent:FireServer()
end)
detector2.MouseClick:Connect(function()
game.Workspace.RemoteEvent:FireServer()
end)
And this is the RemoteEvent Script
local Lid = game.Workspace.Dumpster1.Lid
local OpenLid = game.Workspace.Dumpster1.OpenLid
game.Workspace.RemoteEvent.OnServerEvent:Connect(function()
if Lid.Transparency == 0 then
Lid.Transparency = 1
Lid.CanCollide = false
OpenLid.CanCollide = true
OpenLid.Transparency = 0
if Lid.Transparency == 1 then
Lid.Transparency = 0
Lid.CanCollide = true
OpenLid.CanCollide = false
OpenLid.Transparency = 1
end
end
end)
If there are some Experienced Scripters that are reading this, Is there any better way i can detect if the lid is open or closed or is this okay?
I tried to put as much Details as i could, hopefully it helps. Thanks.
Are you sure that the detector1 ClickDetector exists, and that you are referencing it correctly? The error says that it cannot find the ClickDetector inside of Dumster1.Lid.
If you try using WaitForChild, does it fix the error?
local detector1 = game.Workspace.Dumpster1.Lid:WaitForChild("ClickDetector")
local detector2 = game.Workspace.Dumpster1.OpenLid:WaitForChild("ClickDetector")
I’m confused as to why you are using StarterGui, you can have the ClickDetector in a part in workspace without having to firing events. If you are attempting to open the bin from a GUI you need to use TextButtons.
It does “fix” it at some level. Now when i hover my mouse over any of the lids my cursor just dissapears instead of turning into a hand, is my roblox studio bugged, and when i click, nothing happens
I put it in, i forgot to do it, but it still doesn’t work, my cursor just dissapears when i hover over any of the lids. and when i click, nothing happens
Put this script into a part you want to use to open/close the lid.
local ClickDetector = script.Parent
local Lid = game.Workspace.Dumpster1.Lid
local OpenLid = game.Workspace.Dumpster1.OpenLid
local enabled = false
function Clicked()
if enabled == false then -- if the lid is closed then do code
enabled = true
Lid.Transparency = 1
Lid.CanCollide = false
OpenLid.CanCollide = true
OpenLid.Transparency = 0
elseif enabled == true then -- if the lid is open then do code
enabled = false
Lid.Transparency = 0
Lid.CanCollide = true
OpenLid.CanCollide = false
OpenLid.Transparency = 1
end
end
ClickDetector.MouseClick:Connect(Clicked)
If clickdetector exists as a child of the union then it shouldn’t give you that error. Additionally its good practice to put in print statements for debugging,
The ClickDetector will always appear even if it’s Parent Part is invisible, you could add a lever to the side of the bin and put the ClickDetector in there.
Well, I just now realised that the 2nd clickdetector is useless. It only opens and closes on the clickdetector on the “Lid”. So thank you, you really helped me