wait(3)
local PathfindingService = game:GetService("PathfindingService")
local Humanoid = script.Parent.Humanoid
local Root = script.Parent:FindFirstChild("HumanoidRootPart")
local DressRooms = game.Workspace.DressRooms
local RandomDressRoom = DressRooms[math.random(1, #DressRooms)]
local Dressgoal1 = RandomDressRoom.DressingRoom.Goal1.Position
local Dressgoal2 = RandomDressRoom.DressingRoom.Goal2.Position
local Dressgoal3 = RandomDressRoom.DressingRoom.Goal3.Position
local function moveToGoal(goal)
local path = PathfindingService:CreatePath()
path:ComputeAsync(Root.Position, goal)
local waypoints = path:GetWaypoints()
for i, waypoint in ipairs(waypoints) do
Humanoid:MoveTo(waypoint.Position)
if waypoint.Action == Enum.PathWaypointAction.Jump then
Humanoid.Jump = true
end
Humanoid.MoveToFinished:Wait()
end
end
local function dressing()
moveToGoal(Dressgoal1)
task.wait(0.75)
moveToGoal(Dressgoal2)
task.wait(6)
moveToGoal(Dressgoal3)
end
dressing()
script.Parent.Parent = game.Workspace.Npc
script.Parent["Path find"].Enabled = true
Change this to DressRooms:GetChildren()[math.random(1, #DressRooms:GetChildren())]
“DressingRoom is not valid member of Model Workspace.DressRooms.DressingRoom”
The problem is completely unrelated to the original one.
I think you mean this:
local Dressgoal1 = RandomDressRoom.Goal1.Position
local Dressgoal2 = RandomDressRoom.Goal2.Position
local Dressgoal3 = RandomDressRoom.Goal3.Position
Yeah, How did I not notice it myself…