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

Why wont my sliding door that has two buttons work?

Asked by 6 years ago

I'm trying to make a door that has two buttons but only one button works.

local tweenService = game:GetService("TweenService")


local clickDetector = workspace:WaitForChild("Lever").ClickDetector


local seconds = 11.9


clickDetector.MouseClick:Connect(function()
    wait(2.7)
script.Parent.Rumb:Play()
tweenService:Create(script.Parent, TweenInfo.new(seconds, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = CFrame.new(-232.523, 75.247, -242.881)}):Play()
wait(30)
script.Parent.Rumb:Play()
tweenService:Create(script.Parent, TweenInfo.new(seconds, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = CFrame.new(-232.523, 75.247, -182.133)}):Play()
end)

Thanks if you can help!

0
So you have two buttons, but one click detector? T0XN 276 — 6y
0
There are two, one in each button CaptainAlien132 225 — 6y
0
id rather use a for i loop im not a fan of working with tween services The_Pr0fessor 595 — 6y
0
By the way I suggest not using explicit cframes but instead using rightVector and multiplying an offset so you don't have to re-edit the script when you want to move the doors. EpicMetatableMoment 1444 — 6y

2 answers

Log in to vote
1
Answered by 6 years ago

Not sure if this will work but rename one of the Levers Lever2.

local tweenService = game:GetService("TweenService")


local clickDetector = workspace:WaitForChild("Lever").ClickDetector
local clickDetector2 = workspace:WaitForChild("Lever2").ClickDetector



local seconds = 11.9


clickDetector.MouseClick:Connect(function()
    wait(2.7)
script.Parent.Rumb:Play()
tweenService:Create(script.Parent, TweenInfo.new(seconds, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = CFrame.new(-232.523, 75.247, -242.881)}):Play()
wait(30)
script.Parent.Rumb:Play()
tweenService:Create(script.Parent, TweenInfo.new(seconds, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = CFrame.new(-232.523, 75.247, -182.133)}):Play()
end)

clickDetector2.MouseClick:Connect(function()
    wait(2.7)
script.Parent.Rumb:Play()
tweenService:Create(script.Parent, TweenInfo.new(seconds, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = CFrame.new(-232.523, 75.247, -242.881)}):Play()
wait(30)
script.Parent.Rumb:Play()
tweenService:Create(script.Parent, TweenInfo.new(seconds, Enum.EasingStyle.Linear, Enum.EasingDirection.Out), {CFrame = CFrame.new(-232.523, 75.247, -182.133)}):Play()
end)
0
Thanks CaptainAlien132 225 — 6y
Ad
Log in to vote
0
Answered by 6 years ago
Edited 6 years ago

Likely since you named it "Lever" if they have the same name only one of the children will work. Rename the second one "Lever2" and change the WaitForChild() to Lever2 and that should fix it I think.

Edit: For future reference use script.Parent....

Answer this question