#my door opening script doesnt work

24 messages · Page 1 of 1 (latest)

austere jewel
#

i dont get whats wrong

#

local clickPart = script.Parent.clickPart
local clickDetector = clickPart.ClickDetector

clickDetector.MouseClick:Connect(function(plr)
print(plr.Name.." has touched the door!")

if clickPart:GetAttribute("isOpen") then
    for i, part in pairs(clickPart:GetChildren()) do
        if part:ISA("BasePart") then
            part.CanCollide = true
            if part.Name == "Glass" then
                part.Transparency= 0.5
            else
                part.Transparency = 0
            end
        end
    end
else
    for i, part in pairs(clickPart:GetChildren()) do 
        if part:ISA("BasePart") then 
            part.CanCollide = false
            if part.Name == "Glass" then 
                part.Transparency= 0.75
            else
                part.Transparency = .5
            end
        end
    end
end

clickPart:SetAttribute("isOpen", not clickPart:GetAttribute("isOpen"))

end)

#

also how can i make it so that when you open or close the door it makes a sound

cosmic ledge
#

So like you want

#

if we click on the door it should

#

open

#

right?

#

@austere jewel

austere jewel
#

ya

#

if you want access to game u can friend me and we can team

#

im Zellwand

cosmic ledge
#

how long you have been scripting tho ?

austere jewel
#

ive been trying to fix this for 20 min

cosmic ledge
#

Dm me

#

I have added u on roblox and discord accept

austere jewel
#

alr

#

thanks man

austere jewel
#

bro

#

can someone please help

#

and dont just add a freemodel

thin rampart
#

@austere jewel, so you want it to turn of the collision when you click it?

#

As you could rig a model to move like a door. Which isn’t that much harder to do. But looks way better