I have a brick that is supposed to (on click) disappear and lose collision for 20 seconds, this is the code, and position.
workspace > R123 > ClickDetector > Script
The script is as shown
function OnClick()
if script.Parent.Parent.Transparency == 0 and script.Parent.Parent.CanCollide == true then
OnClick = script.Parent.Parent.Transparency == .6 and script.Parent.Parent.CanCollide == false
wait(20)
script.Parent.Parent.Transparency = 0 and script.Parent.Parent.CanCollide == true
end
end
script.Parent.MouseClick:Connect(OnClick)
nothing happens and the log shows
Enum.KeyCode.Unknown (x1)
even though I defined the key.
When I click on the brick, the console is claiming it is an unknown value as shown here --Enum.KeyCode.Unknown (x1)
[UPDATE]
the console randomly displays this in my mass of clicking
21:58:44.018 - Attempt to connect failed: Passed value is not a function 21:58:44.019 - Stack Begin 21:58:44.020 - Script 'Workspace.R123.ClickDetector.Script', Line 10 21:58:44.020 - Stack End
[UPDATE]
with InfernoExeuctioner's "conclusion" I get the error --
Enum.KeyCode.Unknown 22:00:57.444 - attempt to call a boolean value
[UPDATE]
Script has been edited to this, but I see no reason for it to not work other than what someone said about the "and" conditional.\
local part = script.Parent.Parent
function OnClick() if part.Transparency == 0 and part.CanCollide == true then part.Transparency = .6 part.CanCollide = false wait(20) part.Transparency = 0 part.CanCollide = true end end script.Parent.MouseClick:Connect(OnClick)

4 comments
The site wouldn't let me place the script properly, but (end script.Parent.MouseButton1Click:connect(OnClick)) are in the script
Im sorry, I dont understand why the heck the code wont work
Wait,is the script in the click detector?
yea