Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

How do i make Doors rush like monster?

Hello, I wanted to make Rush like entity to run trought the whole map but the problem is that each waypoint the monster stops walking for 8 seconds after hitting a waypoint and continues walking

Here is what I did

local npc = script.Parent
local humanoid = npc:FindFirstChild("Humanoid")
local waypoints = workspace:FindFirstChild("WaypointsFolder")
local waypointnumber = 1
local waypointscount = 38

for count = 1, waypointscount do
	humanoid:MoveTo(waypoints:FindFirstChild("Waypoint"..waypointnumber).Position)
	humanoid.MoveToFinished:Wait()
	waypointnumber += 1
end

Is there any way to just tween the monster anchored with the same speed to each waypoint?

1 answer

There is, infact! By using relatively simple code, you can make it go from one point to the other!

local waypoints = workspace:FindFirstChild('WaypointsFolder')
local Rush = script.Parent
local TweenService = game:GetService('TweenService')
local currWaypoint = 0
local speed = 1 -- you can edit this however you like

wait(2)

for _, i in pairs(waypoints:GetChildren()) do
	currWaypoint += 1
	if waypoints:FindFirstChild(currWaypoint) then
		local Goal = {Position = waypoints:FindFirstChild(currWaypoint).Position}
		local Waypoint = TweenService:Create(Rush, TweenInfo.new(speed,Enum.EasingStyle.Linear), Goal)
		Waypoint:Play()
	else
		print("ended loop!")
		break
	end
	wait(speed)
end
wait(2)
Rush:Destroy()

Let me know if anything goes wrong!

This discussion is preserved as it was. New answers, comments, and votes are closed.