#how do i fix this bug
78 messages · Page 1 of 1 (latest)
seentarget = false
print("no target")
if script.Parent.HumanoidRootPart.Chase.IsPlaying == true then
coroutine.wrap(function()
for i=1,10 do
script.Parent.HumanoidRootPart.Chase.Volume *= 0.9
end
script.Parent.HumanoidRootPart.Chase:Stop()
end)()
end
script.Parent.Humanoid.WalkSpeed = 15
script.Parent.Humanoid:MoveTo(waypoint.Position)
script.Parent.Humanoid.MoveToFinished:Wait()
this is the whole script when monster doesnt see or is wandering
wat
u didnt tell us what bug ur trynna fix, what solutions u tried and didnt work, whether u did ur research, whats the expected behaviour, what is the actual behaviour, how the unexpected behaviour is replicated, etc etc
if i said "help how do i fix this" and post a random video and code that seems to work what would you tell me
u need to tell me these things
i just did
u didnt look at the video
i did and it was 30 seconds of some thing chasing you
do u not want it to chase u
what
the bug??
u gotta realise that i cant read your mind to tell what u expect it to do
and what solutions u tried
right
changing pathparams
lemme just ask, why are u using coroutine.wrap in the code
i mean i cant even try any other solutions as i dont know why it occurs
to turn volume down
right but why are you wrapping the function
wdym
to not interupt the whole pathfinding system???
aka moving to waypoint and another
u should know that u do interrupt the code regardless
coroutine doesnt utilise multithreadding
from what i remember at least
i think whats happening is he is trying to get to the start position @clear hamlet
do u expect him to stand in place after chasing you or do u expect him to return where he was
wat start position
he goes to a random waypoint
where he was standing at first
he seems to be trying to go there
idk why he hugs to the wall tho
its not like im using a regular moveto instead of pathfinding
because the wall is in the way
u are using MoveTo
so ai wont hug the wall
i mean something like moveto(start.position)
yes thats exactly what u did tho
no
second to last line
function GetWaypoints(wheretogo)
local path = GetPath(wheretogo)
if path.Status == Enum.PathStatus.Success then
for i, waypoint in pairs(path:GetWaypoints()) do
local target = FindTarget()
if target and target:WaitForChild("Humanoid").Health ~= 0 then
script.Parent.Humanoid.WalkSpeed = 27
Attack(target)
seentarget = true
break
else
seentarget = false
print("no target")
if script.Parent.HumanoidRootPart.Chase.IsPlaying == true then
script.Parent.HumanoidRootPart.Chase:Stop()
end
script.Parent.Humanoid.WalkSpeed = 15
script.Parent.Humanoid:MoveTo(waypoint.Position)
script.Parent.Humanoid.MoveToFinished:Wait()
end
end
else
warn("ERROR")
end
end
how come u didnt send this code lol
forgot i didnt include pathfinding
sorry
dont know why it happens tho
cuz it uses pathfinding
does moveto just move in a straight line regardless of walls ahead or does it utilize roblox pathfinding
uses roblxo pathfinding
strange
function GetPath(wheretogo, target, useparams)
local pathParams
if not useparams then
pathParams = {
["AgentHeight"] = 8,
["AgentRadius"] = 4,
["AgentCanJump"] = true,
["AgentCanClimb"] = true
}
end
local path = pathfinding:CreatePath(pathParams)
path:ComputeAsync(script.Parent.HumanoidRootPart.Position, wheretogo)
path.Blocked:Connect(function(blockedWaypointIdx)
if not target then
local allwaypoints = workspace.Waypoints:GetChildren()
local random = math.random(1, #allwaypoints)
repeat
task.wait()
until random ~= currentIndex
currentIndex = random
path:ComputeAsync(script.Parent.HumanoidRootPart.Position, allwaypoints[random])
return path
else
path:ComputeAsync(script.Parent.HumanoidRootPart.Position, target.PrimaryPart.Position)
end
end)
return path
end
make path function
i mean
get path
can u check where the path is by making a temporary part to see it
just make sure the path really isnt in the wall
actually nvm it doesnt work