Ad
Log in to vote
0

How do i script an Automatic Sliding Door?

Asked by
Xianon 105
7 years ago

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?

1 answer

Log in to vote
0
Answered by 7 years ago
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.

Ad

Answer this question