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

Trying to script simple door but the script wont work for some reason, any ideas?

Asked by 3 years ago

So I am doing a simple door. The idea is having two types of doors placed. Open version and closed one. the open version of the door is transparent and have turned off collisions, closed doors have it the other way. What I am doing is having click detector in the door part, and a script which checks if the click decetor has been clicked. If yes it will make collisions false and transaprency 1 for the closed doors, and turn on collisions and transparency to 0 for the opened door. The problem is that when i click the doors, it makes the closed doors transparent and collisons turned off which is what i want BUT the opened doors version doesnt get visible nor collisons turned on, here is script I use for both of the door.:

function onClicked()
    script.Parent.Parent.door1.Transparency = 1
    script.Parent.Parent.door1.CanCollide = false
    script.Parent.Parent.door2.Transparency =0
    script.Parent.Parent.door2.CanCollide = true
end
script.Parent.ClickDetector.MouseClick:connect (onClicked)

Explorer window

2 answers

Log in to vote
0
Answered by 3 years ago

try deleting the script in door2 and then do

script.Parent.ClickDetector.MouseClick:Connect(function()
    script.Parent.Transparency = 1
    script.Parent.CanCollide = false
    script.Parent.Parent.door2.Transparency = 0
    script.Parent.door2.CanCollide = true
end)

if that doesn't work too then dm me on discord:

BlueDuck#8702

0
nah still dont work Robert123456789l 2 — 3y
0
also I tried to dm you but it tells me that noone with this name and tag exists Robert123456789l 2 — 3y
0
try Blue Duck#8902 WINDOWS10XPRO 438 — 3y
0
do you see any errors on the output have you tried debugging? WINDOWS10XPRO 438 — 3y
View all comments (2 more)
0
That works, I sent you friend request bcs I cant msg you till you accept it Robert123456789l 2 — 3y
0
I didnt see any errors and I dont know how to debugg Robert123456789l 2 — 3y
Ad
Log in to vote
0
Answered by 3 years ago

The door were not anchored :D When I anchored them, it worked correctly

Answer this question