function onTouched(hit) hit:BreakJoints() end while true do script.Parent.Touched:connect(onTouched) wait(5) script.Parent.Size = Vector3.new(205.9,10,159.5) script.Parent.Position = Vector3.new(275.085,0.5,-334.35) script.Parent.BrickColor = BrickColor.Blue() script.Parent.Transparency = .3 script.Parent.Material =Enum.Material.Glass script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,1) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,1,2) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,3) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,1,4) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,5) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,1,6) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,7) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,1,8) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,9) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,1,10) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,11) wait(60) wait() end
Create a separate function for the wave generation.
-- Dictionary for vector3 values local Vector3Dict = { [1] = Vector3.new(0,0,1), [2] = Vector3.new(0,1,2), [3] = Vector3.new(0,0,3), [4] = Vector3.new(0,1,4), [5] = Vector3.new(0,0,5) -- and so on... } local function CreateWave(Object) Object.Size = Vector3.new(205.9,10,159.5) Object.Position = Vector3.new(275.085,0.5,-334.35) Object.BrickColor = BrickColor.Blue() Object.Transparency = .3 Object.Material =Enum.Material.Glass for i = 1,5,1 do wait(.1) Object.CFrame = Object.CFrame + Vector3Dict[i] -- changes vec3 end end while true do script.Parent.Touched:connect(onTouched) wait(5) CreateWave(script.Parent) wait(60) end
something like this should work.
I think this should do it.
function onTouched(hit) hit:BreakJoints() end while wait(60) do script.Parent.Touched:connect(onTouched) wait(5) script.Parent.Size = Vector3.new(205.9,10,159.5) script.Parent.Position = Vector3.new(275.085,0.5,-334.35) script.Parent.BrickColor = BrickColor.Blue() script.Parent.Transparency = .3 script.Parent.Material =Enum.Material.Glass script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,1) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,1,2) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,3) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,1,4) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,5) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,1,6) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,7) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,1,8) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,9) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,1,10) wait(.1) script.Parent.CFrame = script.Parent.CFrame + Vector3.new(0,0,11) end