✓ Accepted answer
secretassassin3,
Use this for if the tool should be selected.
local button = script.Parent
door1 = workspace.Doors.Door1
function onClicked(playerWhoClicked)
local characterBits = playerWhoClicked.Character:GetChildren()
for i, bit in pairs(characterBits) do
if bit.ClassName == "Tool" then
door1.Transparency = .2
door1.CanCollide = true
end
end
end
Use this for if the tool should not be selected.
function onClicked(playerWhoClicked)
local tools = playerWhoClicked.Backpack:GetChildren()
for i, tool in pairs(tools) do
if tool.ClassName == "Tool" then
door1.Transparency = .2
door1.CanCollide = true
end
end
end
Sincerely, crazycittykat
1 comment
local button = script.Parent door1 = game.Workspace.Doors.Door1 function onClicked(playerWhoClicked) local playerWhoClicked = button.Click if playerWhoClicked.Backpack.MakeItRain then door1.Transparency = .2 door1.CanCollide = true end end script.Parent.ClickDetector.MouseClick:connect(onClicked)