Okay, so I’m making a game where if you look at the monsters face he will kill you. But I’m having issues where I’m making the same version of the monster but different Mesh/Rig. My code works very well with the other Model but this one has a problem loading animations and the spinning script appearing after when it’s supposed to be fired. I have a reason to believe it’s the group animation ownership/system. I tried publishing them and setting the ownership to me and the group but nothing worked. Is it because of the script or the publishing? What am I doing wrong?
Here’s the spin script:
local module = {}
local TweenService = game:GetService(“TweenService”)
function module.rotateNPC(humanoidRootPart, npc, stopRotationEvent)
if npc and not nil then
local originalOrientation = humanoidRootPart.Orientation -- Store the original Orientation
local continueRotation = true
stopRotationEvent.Event:Connect(function()
continueRotation = false
humanoidRootPart.CFrame = CFrame.new(humanoidRootPart.Position) * CFrame.fromOrientation(originalOrientation.X, originalOrientation.Y, originalOrientation.Z) -- Reset to the original orientation with current position
end)
while continueRotation do
local rotateRight = TweenService:Create(humanoidRootPart, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {CFrame = CFrame.new(humanoidRootPart.Position) * CFrame.Angles(0, math.rad(90.072), 0)}) -- Adjust the rotation angle here
rotateRight:Play()
rotateRight.Completed:Wait()
local rotateLeft = TweenService:Create(humanoidRootPart, TweenInfo.new(1, Enum.EasingStyle.Sine, Enum.EasingDirection.InOut), {CFrame = CFrame.new(humanoidRootPart.Position) * CFrame.Angles(0, math.rad(-90.072), 0)}) -- Adjust the rotation angle here
rotateLeft:Play()
rotateLeft.Completed:Wait()
end
elseif npc == nil then
return
end
end
return module
After he killed me he’s stuck like this.
Before he killed me, he works, chases, walks etc.