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