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

Door won't disappear after I click?

Asked by
Scerzy 85
9 years ago

Okay what I'm trying to do is have a tool "listen" for a click and then take appropriate action as suggested by a user named "yumtaste" (in this case, it's making a door fade). For some reason, it does not work. The following script is inserted into the tool

local door = game.Workspace.BigDoor
script.Parent.Equipped:connect(function(mouse)
if mouse.Target then
if mouse.Target == door then
        for i = 1, 10 do

            door.Transparency = door.Transparency + .05

            wait(.1)

        end
wait(10)
door.Transparency = 0.5

end
end
end)

The following script is inserted into the door

if script.Parent.Transparency == 0 then
script.Parent.CanCollide = false
else
script.Parent.CanCollide = true
end

Does anyone see the problem?

1 answer

Log in to vote
0
Answered by 9 years ago

add this to your script instead of the mouse target what mouse target does is it waits until your mouse is hovering over the door then it proceeds but this listens for that click. Put it in a localscript also

mouse.Button1Down:connect(function()
--code
end)
0
I'm confused, do I replace lines 2-4 with this? Scerzy 85 — 9y
0
lines 3-4 threatboy101 2 — 9y
Ad

Answer this question