Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do I fix this slider?

I'm trying to make double doors and when I click the switch, nothing happens. Please help?


ldoor=script.Parent.Parent.Ldoor
rdoor=script.Parent.Parent.Rdoor
debounce = true

function move()
	if debouce == true then
		debounce = false
		for i=1,14 do
			ldoor.CFrame=CFrame.new(ldoor.CFrame.x + .5,ldoor.CFrame.y,ldoor.CFrame.z)
			rdoor.CFrame=CFrame.new(rdoor.CFrame.x - .5,rdoor.CFrame.y,ldoor.CFrame.z)
			wait()
		end
		wait(1.5)
		for i=1,14 do
			ldoor.CFrame=CFrame.new(ldoor.CFrame.x - .5,ldoor.CFrame.y,ldoor.CFrame.z)
			rdoor.CFrame=CFrame.new(rdoor.CFrame.x + .5,rdoor.CFrame.y,rdoor.CFrame.z)
			wait()
		end
		debounce=true
		end
		end

script.Parent.ClickDetector.MouseClick:connect(move)

2 comments

0

Is there an error in the output?

0

Suprisingly none.

1 answer

✓ Accepted answer

I have no idea why it won't work. I set it all up in Studio and ran it like this

ldoor = script.Parent.Parent.Ldoor
rdoor = script.Parent.Parent.Rdoor
debounce = true

function onClicked()
    if debouce == true then
        debounce = false
		i = 1
        repeat
			i = i+1
            ldoor.CFrame = CFrame.new(ldoor.CFrame.X +1, ldoor.CFrame.Y , ldoor.CFrame.Z)
            rdoor.CFrame = CFrame.new(rdoor.CFrame.X -1, rdoor.CFrame.Y, rdoor.CFrame.Z)
            wait(.01)
        until i == 14
        wait(1.5)
		i = 1
        repeat
			i = i+1
            ldoor.CFrame=CFrame.new(ldoor.CFrame.X -1, ldoor.CFrame.Y, ldoor.CFrame.Z)
            rdoor.CFrame=CFrame.new(rdoor.CFrame.X +1, rdoor.CFrame.Y, rdoor.CFrame.Z)
            wait()
		until i == 14
        debounce=true
	end
end

script.Parent.ClickDetector.MouseClick:connect (onClicked)

Could not get it to work.

1 comment

0

Something is up with studio or its just my wrongdoing...

This discussion is preserved as it was. New answers, comments, and votes are closed.