I'm triying to make an automatic sliding door using Cframe and also that lets detect an Humanoid so it activates, but i don't know how to use Cframe on a script yet can somebody help me?
✓ ANSWER ACCEPTED
How do i script an Automatic Sliding Door?
1 answer
✓ Accepted answer
local running=false
function onTouch(hit)
if running==false then
if hit.Parent:findFirstChild("Humanoid") then
running=true
for I=1, 100 do
script.Parent.CFrame=script.Parent.CFrame+Vector3.new(0.1,0,0)
wait()
end
wait(3)
for I=1, 100 do
script.Parent.CFrame=script.Parent.CFrame-Vector3.new(0.1,0,0)
wait()
end
running=false
end
end
end
script.Parent.Touched:connect(onTouch)
This will move the parent of this script ten studs on the x-axis, and then back again.
This discussion is preserved as it was. New answers, comments, and votes are closed.
