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?
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)