Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
2

What else do I have to put in this script to make it work?

Asked by
Nidoxs 190
9 years ago
local isOpen = true

function open()
    isOpen = true
    script.Parent.D3.Transparency = 0
    script.Parent.D3.CanCollide = true 
    script.Parent.D4.Transparency = 0
    script.Parent.D4.CanCollide = true 
    script.Parent.D1.Transparency = 1  
    script.Parent.D1.CanCollide = true 
    script.Parent.D2.Transparency = 1  
    script.Parent.D2.CanCollide = true
end

function closed()
    isOpen = false
    script.Parent.D3.Transparency = 1
    script.Parent.D3.CanCollide = true 
    script.Parent.D4.Transparency = 1
    script.Parent.D4.CanCollide = true 
    script.Parent.D1.Transparency = 0  
    script.Parent.D1.CanCollide = true 
    script.Parent.D2.Transparency = 0  
    script.Parent.D2.CanCollide = true
end

function onClicked()

    if isOpen == true then closed() else open() end

end

I want CanCollide on at all times
D1,D2,D3 and D4 = Door 1, Door 2, Door 3 and Door 4.

2 answers

Log in to vote
0
Answered by 9 years ago

Everything says true, which means Cancollide is on at all times. (put false to deactivate) I don't know the problem here...

Have you added a button to open these doors? Get a part, add clickdetector, put on the very top of script saying "function onclicked()" Make sure after the "end" of the second door set, it must have a mouseclick thing. Check through free models for that.

0
I want CanCollide on at all times, I have added a button (First D3 & D4 are transparent) and when you click it D1 & D2 go transparent and D3 & D4 go visible. The button goes through both doors and has CanCollide off. But it still does not work? Nidoxs 190 — 9y
0
You might have to do a bit of trial and error. I'm not that expirenced in Lua and scripts, but it's best if you can ask Robloxmannnnnnnn on Roblox. Wheel326 0 — 9y
Ad
Log in to vote
0
Answered by
Marolex 45
9 years ago

There are ceveral things wrong here.

1: your script you could use a lot of improvements in efficiency.

2: you have no event firing the script.

0
several* thesit123 509 — 6y

Answer this question