Help with Finding the position of a R6 Character's Torso

for a long term solution with multiples players, maybe try and make it look at the player closest to it, if you want me to show you how I can

That’ll work, Thanks.

Also, The game WILL have singleplayer and multiplayer.
(Multiplayer is gonna be recommended because its easier on the player.)

This is what you might want to do (if finding the player closest)

function avoid()
	hum:MoveTo(Vector3.new(0,0,math.random(-10,10)))
	hum.MoveToFinished:Wait()
    local char = getClosestCharacter()
	myRoot.CFrame = CFrame.lookAt(Vector3.new(char.Torso.Position.X, char.Torso.Position.Y, char.Torso.Position.Z)) 
end

So, We’re making progress.

I didnt get Any errors, but the Boss never looked at the Player.

hmm maybe try

myRoot.CFrame = CFrame.new(myRoot.Position,Vector3.new(char.Torso.Position.X,myRoot.Position.Y,char.Torso.Position.Z))
1 Like

Got this error: “Attempt to index nil with Torso”

Actually, I just got it to work! I’ll send the script.

local Boss = game.Workspace.Boss
local hum = Boss:WaitForChild("Humanoid")
local myRoot = Boss:WaitForChild("HumanoidRootPart")

local char
local players = game:GetService("Players")

game.Players.PlayerAdded:Connect(function(plr)
	char = plr.Character or plr.CharacterAdded:Wait()
end)

function avoid()
	local dashDecide
	dashDecide = math.random(1,2)
	if dashDecide == 1 then
		hum:MoveTo(Vector3.new(10,0,0))
		hum.MoveToFinished:Wait() 
		dashDecide = false
	elseif dashDecide == 2 then
		hum:MoveTo(Vector3.new(-10,0,0))	
		hum.MoveToFinished:Wait() 
		dashDecide = false
	end
end


pcall(avoid)
while true do
	wait(0.1)
	myRoot.CFrame = CFrame.new(myRoot.Position,Vector3.new(char.Torso.Position.X,myRoot.Position.Y,char.Torso.Position.Z))
end
	

You have my gratitude.

1 Like

I’m glad you got it to work! I wish you luck with your boss, if you wanna let me know when your game releases I would be happy to play it and provide feedback

1 Like

Thank you! And I will let you know when the game Releases.
Seriously, It’s been about 4 days of tryna figure this out :sweat_smile:
Again, Thank you so much.

1 Like

Why does this thread have 29 replies? Now 30 including mine.

local players = game:GetService("Players")
local player = players.LocalPlayer or players.PlayerAdded:Wait()
local character = player.Character or player.CharacterAdded:Wait()
local torso = character:WaitForChild("Torso")
local torsoPos1 = torso.Position --vector3 value
local torsoPos2 = torso.CFrame --cframe value