In my project, I have a base script that fires a remote event that causes the NPC to begin walking. The only issue is that while it DOES move, it's not when I want. It's around a 2-5 second delay. (i haven't counted i probably should've)
Here is the code.
Base script:
local ShowDialog = game.ReplicatedStorage.ShowDialog local ShowTinaDialog = game.ReplicatedStorage.ShowTinaDialog local Opening = game.ReplicatedStorage.Opening local OpeningWalk = game.ReplicatedStorage.OpeningWalk --//Waiting for Players while true do wait(2) contestants = {} for _, player in pairs(game.Players:GetPlayers()) do if player and player.Character then local humanoid = player.Character:WaitForChild("Humanoid") if humanoid and humanoid.Health > 0 then table.insert (contestants, player) end end end if #contestants >= 1 then print "We have enough" break else end end --//Table of Team Names (referred to as tribes bc i forgot i was making tdi and not survivor) local Tribes = { 'Dancing Mice', 'Shouting Wolves', 'Thriller Whales', 'Running Lions', 'Sitting Ducks' } --//Setting up Teams print "Choosing teams." local team = Instance.new("Team") team.TeamColor = BrickColor.random() team.Parent = game:GetService("Teams") local teamnumberchosen = math.random(5) team.Name = Tribes[teamnumberchosen] team.AutoAssignable = false table.remove(Tribes, (teamnumberchosen)) print "Team one made." local team = Instance.new("Team") team.TeamColor = BrickColor.random() team.Parent = game:GetService("Teams") local teamnumberchosen = math.random(4) team.Name = Tribes[teamnumberchosen] team.AutoAssignable = false table.remove(Tribes, (teamnumberchosen)) print "Team two made." --//Opening Sequence OpeningWalk:FireAllClients() print "Walking fired." Opening:FireAllClients() print "Opening fired."
NPC Movement:
Opening = game:GetService("ReplicatedStorage").OpeningWalk --//More Variable Thingies local model = workspace.TinaOpening local hum = model.Tina.Humanoid hum.WalkSpeed = 10 --//Make her WALK local function onOpeningWalk() print "Starting to walk" hum:MoveTo(model.PointA.Position) hum.MoveToFinished:Wait() hum:MoveTo(model.PointB.Position) hum.MoveToFinished:Wait() hum:MoveTo(model.PointC.Position) hum.MoveToFinished:Wait() hum:MoveTo(model.PointD.Position) hum.MoveToFinished:Wait() hum:MoveTo(model.PointE.Position) hum.MoveToFinished:Wait() print "Done walking." end Opening.OnClientEvent:connect(onOpeningWalk)