Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

how to make a wall cancollide = false when clicked?

Asked by 8 years ago

heres my attemp:

local wall = script.Parent local mouse = game.Player:GetMouse() local click = game.Workspace.wall1.ClickDetector:Touched()

local function closeWall(part) wall.CanCollide = true for transparency = 0, 0, 0 do door.Transparency = transparency wait(.1)
end

function openDoorOnClick() if mouse.click.wall then wall.CanCollide = false for transparency = 1, 0, -.1 do door.Transparency = transparency wait(.1) wait(5) closeWall end

0
forgot to add: krustatiion -3 — 8y
0
local mouse = game.Player:GetMouse() krustatiion -3 — 8y

1 answer

Log in to vote
1
Answered by 8 years ago
Edited 8 years ago

You can't touch a click detector.

Try doing:

local wall = script.Parent 
 local click = game.Workspace.wall1.ClickDetector.MouseClick

local function closeWall() 
wall.CanCollide = true 
for transparency = 0, 0, 0 do 
door.Transparency = transparency 
wait(.1)
end

function openDoorOnClick() 
 wall.CanCollide = false 
for transparency = 1, 0, -.1 do 
door.Transparency = transparency 
wait(.1) 
wait(5) 
closeWall()
end
click:connect(openDoorOnClick)

You also don't need to get the mouse. You also need to use the events.

Ad

Answer this question