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

[Solved] Npc walking always on the same Position X Y Z ?

Asked by 4 years ago
Edited 4 years ago

Hello everyone,

I have a Problem with a Dummy (NPC) i move the Dummy to 5 different Positions then i copyed the Position of the HumanoidRootPart to my Script.

The Problem is he is Walking but the coordinates stuck on the same coordinates in my thes he is picking always 446.391, 33.257, -429.729

Here is the Script

local zombie = script.Parent
local humanoid = script.Parent.Humanoid

local table = {"446.391, 33.257, -429.729","525.641, 33.257, -445.209","602.141, 33.257, -448.109", "503.951, 33.257, -356.769", "525.841, 33.257, -511.769"}

local value = math.random(1,#table)
local coordinates = table[value]

while wait(5) do
        print("Coordinates -->" ..coordinates)
        humanoid:moveTo(Vector3.new(coordinates), workspace.Arena.Base)
        print("Moving to Point")
end

local value = 0
local coordinates = 0

Here you see the example

Coordinates -->503.951, 33.257, -356.769
  Moving to Point
  Coordinates -->503.951, 33.257, -356.769
  Moving to Point
  Coordinates -->503.951, 33.257, -356.769
  Moving to Point
  Coordinates -->503.951, 33.257, -356.769
  Moving to Point
  Coordinates -->503.951, 33.257, -356.769
  Moving to Point

I don't know why and he is going outside of workspace.Arena.Base

1
math.random() is only returning 1 random value, and the script is using that value. This is because math.random() is outside of the loop and therefore only runs once. DeceptiveCaster 3761 — 4y
0
Thank you :) Ravage1337 35 — 4y

Answer this question