Hello, how do i make it so in this script at random points in time it stops animating the part for a random amount of time?
Script:
local seed = 3
local p = script.Parent.Humanoid
function r()
seed = seed + 3
math.randomseed(tick() + seed)
end
function go(part)
p:MoveTo(part.Position)
p.MoveToFinished:Wait()
end
local locsv = game.Workspace:WaitForChild("WanderPoints")
local locs = locsv:GetChildren()
local loc = locsv:WaitForChild("Start")
local prev = loc
while true do
local locs = locsv:GetChildren()
go(loc)
local tab = {}
for i = 1,#locs,1 do
local sub = locs[i]
if (loc.Position-sub.Position).Magnitude <= 32 and sub ~= loc and sub ~= prev then
table.insert(tab,#tab+1,sub)
end
end
--We now have a table of possible locations.
r()
local newVar = math.random(1,#tab)
prev = loc
loc = tab[newVar]
go(loc)
wait()
end