localTweenService=game:GetService("TweenService")localServerStorage=game:GetService("ServerStorage")localSimplePath=require(ServerStorage.SimplePath)localModel=workspace.ModellocalGoal=workspace.GoallocalPath=SimplePath.new(Model)localfunctiontween(part,destination)localtweenBase=TweenService:Create(part,TweenInfo.new(0.07),{Position=destination+Vector3.new(0,0.5,0)})tweenBase:Play()tweenBase.Completed:Wait()endPath.Visualize=true--Tween model to final waypoint when reachedPath.Reached:Connect(function(model,finalWaypoint)tween(model.PrimaryPart,finalWaypoint.Position)end)--Call Path:Run() at the end of the event to indicate the end of movement for the current waypointPath.WaypointReached:Connect(function(model,lastWaypoint,nextWaypoint)tween(model.PrimaryPart,nextWaypoint.Position)Path:Run()end)Path:Run(Goal)
localTweenService=game:GetService("TweenService")localServerStorage=game:GetService("ServerStorage")localSimplePath=require(ServerStorage.SimplePath)localModel=workspace.ModellocalGoal=workspace.GoallocalPath=SimplePath.new(Model)localfunctiontween(part,destination)localtweenBase=TweenService:Create(part,TweenInfo.new(0.07),{Position=destination+Vector3.new(0,0.5,0)})tweenBase:Play()tweenBase.Completed:Wait()endPath.Visualize=true--If the path is blockedPath.Blocked:Connect(function()Path:Run(Goal)end)--In case of an errorPath.Error:Connect(function()Path:Run(Goal)end)Path.Reached:Connect(function(model,finalWaypoint)tween(model.PrimaryPart,finalWaypoint.Position)Path:Run(Goal)end)Path.WaypointReached:Connect(function(model,lastWaypoint,nextWaypoint)tween(model.PrimaryPart,nextWaypoint.Position)Path:Run(Goal)end)Path:Run(Goal)