Hello, I am new to Lua, i'm attempting to make a door which you click to walk through. I don't know whats wrong with the code.
if clicked = (true)
then Game.Workspace.Door.CanCollide = (false)
end
Please help.
Hello, I am new to Lua, i'm attempting to make a door which you click to walk through. I don't know whats wrong with the code.
if clicked = (true)
then Game.Workspace.Door.CanCollide = (false)
end
Please help.
You need put a click detector on the button and the script inside it, and do something like that
local button = script.Parent
button.ClickDetector.MouseClick:Connect(function()
game.workspace.Door.CanCollide = false
You need to use a ClickDetector. I modified the example on the Wiki page to fit your door.
local clickDetector = Instance.new("ClickDetector")
local function onMouseClick(player)
game.Workspace.Door.CanCollide = false
end
clickDetector.Parent = game.Workspace.Door
clickDetector.MouseClick:connect(onMouseClick)
This discussion is preserved as it was. New answers, comments, and votes are closed.
2 comments
Why r u using parenthesis for that?
Also, you need to use '==' to compare two values.