CFrame Not Moving

The print statement is firing but the humanoid isn’t moving, even though the ‘Team’ attribute is on 1
No errors fyi
plz help

local char = script.Parent
local team = char:GetAttribute("Team")
local cframe = char.HumanoidRootPart.CFrame
local ED = char.EnemyDetector


local function ActionZero() -- For moving and stuff

	if char:GetAttribute("Team") == 1 or char:GetAttribute("Team") == 3 then
		print("test")
		cframe += Vector3.new(0.01,0,0)
		task.wait(0.01)
		return
			
	elseif char:GetAttribute("Team") == 2 or char:GetAttribute("Team") == 4 then
		
		cframe += Vector3.new(-0.01,0,0)
		task.wait(0.01)
		return
			
	else
		
		print("lol")
		task.wait(0.01)
		return
			
	end

end


local function ActionOne() -- for basic attacks
	
end


local function ActionTwo() -- for other abilities
	
end


while true do
	if char:GetAttribute("ActionQued") == 0 then
		ActionZero()
	elseif char:GetAttribute("ActionQued") == 1 then
		print("test2")
	elseif char:GetAttribute("ActionQued") == 2 then
		print("test3")
	else
		task.wait(0.01)
	end
end

Your passing in vector it needs to be cframe

You are making a value of the CFrame.

This means you are storing the CFrame value, changing it will only change the “cframe” value. Not the HumanoidRootPart’s CFrame.

If you want to edit the HumanoidRootPart’s CFrame you need to directly address it.
You also input a vector value not a CFrame…

Do this for example:

local char = script.Parent
local humanoidRootPart = char.HumanoidRootPart

humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.Position + Vector3.new(0.01, 0, 0))

Tried that, still doesn’t move

Can I see what you put?

btw I just realized you can also do

humanoidRootPart.CFrame += Vector3.new(.01, 0, 0)

Mb for confusion

My code is similar

HRP.CFrame += Vector3.new(0.01,0,0)

Wait is it a client or a server script

Server, no client bafoonery here

what is this script trying to do?
(I have no idea what is wrong with it unless there’s some outer factors I am unaware of)

The only thing I can see going wrong is that you are using a server script to move the client character by a small amount. Since this amount is on server and is almost insignificant the client just rejects it and makes the character stay in place.

Adding a Vector3 to a Humanoid’s CFrame on the server usually won’t result in movement, because the Humanoid’s physics can override it. Try setting a target for the Humanoid to move to or adjust its velocity. Ran into so many I think I should add this too. I’m just going to go with this reply, most likely the main issue. I’ll PM you the book I was working on.. :rofl:

No, this is a npc that is hosted on the server.
Fyi, Im making a 1D Strategy game (ie Battle Cats)

Ohh.. well it changes a lot but now I really don’t have an idea since I can’t really see what is happening there for my self. Based on how we improved the script I don’t see what’s wrong. I’ll come back tomorrow and if it’s still not fixed il help. Good luck!

Humaniods don’t have CFrames, I checked

Wait am I stupid, the model is moving now, I may have fixed it a while ago and not noticed.
sorry everyone

Well, I didn’t mean “Humanoid’s CFrame” per se; it’s the HumanoidRootPart that controls a character’s position. Glad you got it.