Im trying to make a door open when you click on it and since im not good enough to animate it to slide open i will just make it go invisible once you click on it and 5 seconds later it should just appear again both dissapearing and appearing with a sound, below is the script, it doesnt work…
local model = script.Parent.parent:getchildren
local clickdetector = script.Parent
local set = true
clickdetector.MouseClick:Connect(function()
if (set == true) then
model.transparency = 1
wait(5)
set = false
model.transparency = 0
end
if (set == false) then
model.transparency = 0
set = true
end)
hi, i will look onto script later but i want to inform u, u need to change “CanCollide” To Make Players Or Objects Pass Throught It. Transparency Is Just Visibility Of Object.
local model = script.Parent.Parent
local clickdetector = script.Parent
local set = true
for _,v in pairs(model:GetChildren()) do
if v:IsA("Part") then
clickdetector.MouseClick:Connect(function()
if (set == true) then
v.Transparency = 1
wait(5)
set = false
v.Transparency = 0
end
if (set == false) then
v.Transparency = 0
set = true
end
end)
end
end
I changed a bit of your code, but didn’t replace it completely
how do i make this also work for wedges? because it doesnt change wedges, also is there a delay or is that just my lag?
also here is edited with cancollide added
local model = script.Parent.Parent
local clickdetector = script.Parent
local set = true
for _,v in pairs(model:GetChildren()) do
if v:IsA(“Part”) then
clickdetector.MouseClick:Connect(function()
if (set == true) then
v.Transparency = 1
v.CanCollide = false
wait(5)
set = false
v.Transparency = 0
v.CanCollide = true
end
if (set == false) then
v.Transparency = 0
v.CanCollide = true
Just copy the script from if v:IsA("Part") then and paste it in the below and change the “Part” to “WedgePart”, it can be anything, if you didn’t understand, here’s:
local model = script.Parent.Parent
local clickdetector = script.Parent
local set = true
for _,v in pairs(model:GetChildren()) do
if v:IsA("Part") then
clickdetector.MouseClick:Connect(function()
if (set == true) then
v.Transparency = 1
v.CanCollide = false
wait(5)
set = false
v.Transparency = 0
v.CanCollide = true
end
if (set == false) then
v.Transparency = 0
v.CanCollide = true
set = true
end
end)
end
if v:IsA("WedgePart") then
clickdetector.MouseClick:Connect(function()
if (set == true) then
v.Transparency = 1
v.CanCollide = false
wait(5)
set = false
v.Transparency = 0
v.CanCollide = true
end
if (set == false) then
v.Transparency = 0
v.CanCollide = true
set = true
end
end)
end
end
Find a sound from library and copy the id from the link, and add a “Audio” from Roblox Studio into your models, and paste the id into the Audio properties, and you can play it inside of open door using Audio:Play() and Audio:Stop(), I can’t explain it more detail.