the parent is the tool. This is for a key door, this script allows you to go through the door. But it just won't.
Also it works in Playtest but not Online
bin = script.Parent function onButton1Down(mouse) local hit = mouse.Target if (hit == nil) then return end if (hit.Name == "SilverDoor2") then hit.Transparency = 0.8 hit.CanCollide = false wait(2) hit.CanCollide = true hit.Transparency = 0 end end function onSelected(mouse) print("Action Tool Selected") mouse.Button1Down:connect(function() onButton1Down(mouse) end) end bin.Selected:connect(onSelected)
bin = script.Parent function onButton1Down(mouse) local hit = mouse.Target if (hit == nil) then return end if (hit.Player.Name == "SilverDoor2") then hit.Transparency = 0.8 hit.CanCollide = false wait(2) hit.CanCollide = true hit.Transparency = 0 end end function onSelected(mouse) print("Action Tool Selected") mouse.Button1Down:connect(function() onButton1Down(mouse) end) end bin.Selected:connect(onSelected)
You use 'hit.Player.Name'
i think the problem is when you put end on 14 and 15,so try removing end