I cannot seem to understand why the character is not moving to the location passed to the MoveTo() function.
Here is my code:
function GetLocation(self)
if RS:IsClient() then
local WorldName = self.WorldName
local Location = self.Position
local VirtualWorldsAdded = workspace.VirtualWorlds:GetChildren()
local PositionFound = false
local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:wait()
for _,v in pairs(VirtualWorldsAdded)do
if v.Name == WorldName then
for _,child in pairs(v:GetChildren())do
if child.Name == Location then
print("PositionFound")
PositionFound = child.Position
Character:MoveTo(child.Position)
end
end
end
end
end
end
i know that the position is found as i printed out the PositionFound variable and a vector3 value as expected was outputted. However, the character is just not being moved to the required position. Any assistance will be greatly appreciated.