NPC torso not changing orientation on event

I am making it so that the npc changes orientation when an event happens, but it doesn’t work, no errors and not printing working. Script.

local tool = script.Parent
local range = script.Parent.Parent.Stats.range.Value
local damage = script.Parent.Parent.Stats.damage
local Bullet = Instance.new("Part", workspace)
local ShootSpeed = script.Parent.Parent.Stats.shootspeed.Value
local Sound = script.Parent.Sound
local Radius = Instance.new("Part", workspace)
local PoliceEvent = game.ReplicatedStorage.Events.PoliceEvent
Radius.CanCollide = false
Radius.Parent = tool
Radius.Position = tool.Parent["Left Leg"].Position
Radius.Position = Radius.Position + Vector3.new(0,0.025,0)
Radius.CanCollide = true
Radius.Anchored = true
Radius.Size = Vector3.new(10,0,10)
Radius.Name = "PoliceRadius"
function shoot()
	Bullet.Transparency = 0
	Bullet.CanCollide = true
	Bullet.Position = script.Parent.Handle.Position
	Bullet.Anchored = true
	Bullet.Name = "Police1Bullet"
	Bullet.BrickColor = BrickColor.new("New Yeller")
	Bullet.TopSurface = Enum.SurfaceType.Smooth
	Bullet.BottomSurface = Enum.SurfaceType.Smooth
	Bullet.Size = Vector3.new(0.3,0.1,0.1)
	Bullet.Orientation = Vector3.new(0, 90, 0)
	Bullet.Parent = tool
function onPoliceEvent()
	for yes = 1,range do
			wait(0.01)
			print("working")
			tool.Parent.Torso.Orientation = script.Parent.Parent.ClosesEnemyRotation.Value
			---Bullet.Position = Bullet.Position + Vector3.new(0,0,-1)
	end
PoliceEvent.Event:Connect(onPoliceEvent)
end
while wait(ShootSpeed) do
	Sound:Play()
	shoot()
	end
1 Like

It is likely do to you trying to set the orientation of a part within the rig. For manipulating anything more than super basic geometric values, you should use CFrames (especially for character rigs, but really anything). This is a good place to start: https://developer.roblox.com/en-us/api-reference/datatype/CFrame

If you like videos, this may be of help. (I do not endorse this YTber, but I know they have good videos):

1 Like