My script:
local TweenService = game:GetService("TweenService")
local tweenInfo = TweenInfo.new(3, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut)
local goalTop = Vector3.new(17, 8.6, 7)
local goalBottom = Vector3.new(17, -0.6, 7)
local returnTop = Vector3.new(17, 5.5, 7)
local returnBottom = Vector3.new(17, 2.5, 7)
local top = script.Parent.Top
local bottom = script.Parent.Bottom
function touched(Touched)
connection:Disconnect()
print(Touched.Name .. " touched")
if not Touched.Parent:FindFirstChildWhichIsA("Humanoid") then connection = script.Parent.Touch.Touched:Connect(function(hit) touched(hit) end) return end
print("Got past if")
local tween1 = TweenService:Create(top, TweenInfo, {Position = goalTop})
local tween2 = TweenService:Create(bottom, TweenInfo, {Position = goalBottom})
local retTween1 = TweenService:Create(top, TweenInfo, {Position = returnTop})
local retTween2 = TweenService:Create(bottom, TweenInfo, {Position = returnBottom})
print("assigned")
tween1:Play()
tween2:Play()
print("played?")
tween1.Completed:Wait()
wait(3)
print("waited")
retTween1:Play()
retTween2:Play()
retTween1.Completed:Wait()
wait(2)
connection = script.Parent.Touch.Touched:Connect(function(hit) touched(hit) end)
end
connection = script.Parent.Touch.Touched:Connect(function(hit) touched(hit) end)
It errors on line 18 giving me this:
Help me please!