The script is a local script inside a players gui, what i wanted it to do is rotate the characters body so it is facing what way the camera is facing, I thought this would work but the character doesnt even rotate.

p.s the prints at the end dont print anything

local plr = game.Players.LocalPlayer
local flying = false
local cam = workspace.Camera

function fly()
	local char = plr.Character
	local bgy = Instance.new("BodyGyro",char.HumanoidRootPart) bgy.Name = "B_Gyro"
	flying = true
	workspace.Gravity = 0
	local pos1 = char.HumanoidRootPart.Position
	char.HumanoidRootPart.Position = Vector3.new(pos1.X,pos1.Y + 5,pos1.Z)
	char.Humanoid.PlatformStand = true
	while flying do
		local lookv = cam.CFrame.LookVector
		wait(.1)
		bgy.CFrame = CFrame.Angles(math.rad(lookv.X),math.rad(lookv.Y),math.rad(lookv.Z))
	end
end

wait(3)

fly()

wait(3)

print(workspace.Plieax.HumanoidRootPart.CFrame)
print(workspace.Plieax.B_Gyro.CFrame)

1 comment

0

dont use the 2nd parameter of instance.new, it negatively affects game performance