Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

WalkToPoint (in region) AI problem?

Asked by
Qorm 100
8 years ago

I have a problem, I made a region, and the script randomly chooses 3 points within the region, when testing, the Models go to the same position.

It's pretty inefficient right now

repeat wait() until script.Parent.Parent.Parent~="ServerStorage" and script.Parent.Parent.Parent.Parent:IsA("Model")
part=script.Parent.Parent.Parent.Parent:FindFirstChild("Spawner")

p1=Vector3.new(part.Position.X+60,part.Position.Y+1,part.Position.Z+40)
p2=Vector3.new(part.Position.X-60,part.Position.Y,part.Position.Z-40)
p12=(p1-p2)

while true and wait(1) do --just for testing
local region=p2+Vector3.new(math.random(p12.X),math.random(p12.Y),math.random(p12.Z))
print(region)
script.Parent.WalkToPoint=Vector3.new(region)
end

I'm not quite sure what's happening...

Help or tips would be appreciated.

And here's a gif on what's happening: https://gyazo.com/0879694b5d7e9ad50dbdd3e70bda6b81

0
What is happening is that the math.random constructors you put in contain only one entry. Marios2 360 — 8y
0
Every Model has their own individual AI Script, therefor they all return different values Qorm 100 — 8y

Answer this question