I have this snippet of code:
for i, v in pairs(path:GetWaypoints()) do
humanoid:MoveTo(v.Position)
humanoid.MoveToFinished:Wait()
local cylinder = Instance.new("Part", visualpath)
cylinder.Shape = "Cylinder"
cylinder.Size = Vector3.new(0.5, 1, 1)
cylinder.Orientation = Vector3.new(0, 0, 90)
cylinder.Color = Color3.new(1,1,1)
cylinder.Material = Enum.Material.Neon
cylinder.Anchored = true
cylinder.CanCollide = false
cylinder.Position = v.Position + Vector3.new(0, 1, 0)
debris:AddItem(cylinder, 2)
end
The code works as expected, but it looks really unorganised in my script since it takes up a large block of space in my code. I would preferably have it in a ModuleScript or if i needed to, table of properties at the start but I’m not sure how to do this. This includes the Debris, but I’m not sure if that is possible since I have not seen a solution to this yet. I would be really grateful if someone could help me with this, thank you!