gpt-4o-2024-05-13· OpenAI
WildChat-4.8M (AI2)
local Dummy = script.Parent local Humanoid = Dummy:WaitForChild("Humanoid") while true…
- User
local Dummy = script.Parent local Humanoid = Dummy:WaitForChild("Humanoid") while true do wait(1) Humanoid:MoveTo(Vector3.new(math.random(-50,50),0,math.random(-50,50))) end
can you make it randomly pick out of a table of different coordinates?
- Assistant
Certainly! You can create a table of predefined coordinates and then randomly pick one of them to move the Humanoid to. Here's how you can modify your script to do that:
lualocal Dummy = script.Parent local Humanoid = Dummy:WaitForChild("Humanoid") -- Define a list of coordinates local coordinates = { Vector3.new(-50, 0, -50), Vector3.new(50, 0, -50), Vector3.new(-50, 0, 50), Vector3.new(50, 0, 50), Vector3.new(0, 0, 0) -- Add as many coordinates as you want } while true do wait(1) -- Pick a random coordinate from the table local randomIndex = math.random(1, #coordinates) local randomCoordinate = coordinates[randomIndex] -- Move the Humanoid to the random coordinate Humanoid:MoveTo(randomCoordinate) end