I’m making an ability for a monster where it can go under the map and pop up somewhere else, and right now I’m stuck with the going under part. For some reason, when tweening the humanoid root part of the monster, it either doesn’t move at all or the entire model is just removed out of sight.
My script: (so far)
repeat
task.wait()
until (script.Parent):IsA("Model")
if script.Parent.Name == "Umbra Monstrum" then
local hrp = script.Parent:WaitForChild("HumanoidRootPart")
local ts = game:GetService("TweenService")
local tweeninfo = TweenInfo.new(1, Enum.EasingStyle.Linear, Enum.EasingDirection.In, 0, false)
local tween = ts:Create(hrp, tweeninfo, {CFrame = hrp.CFrame * CFrame.new(Vector3.new(0, -4, 0))}) --Changing the value from -4 to -1, -2, or -3 will leave it in its place, but -4 and -5 will make the entire model disappear from sight, even before the animation plays
local hum = script.Parent:WaitForChild("Humanoid")
hum.HealthChanged:Connect(function(health)
local max = hum.MaxHealth
if health*2 == max then
hum.WalkSpeed = 0
local animcontroller = hum:WaitForChild("Animator")
local anim = hum:WaitForChild("Shadow")
local shadowanimation = animcontroller:LoadAnimation(anim)
shadowanimation.Priority = Enum.AnimationPriority.Action3
shadowanimation:Play() --the animation I mentioned in the above comment, the animation does play when I don't set the Vector3 Y axis to -4 and below
task.wait(2)
tween:Play()
end
end)
hum.Health = 3 --Test purposes only
end
Roblox doesn’t give me any errors or warnings (like prints but in yellow color) and just the things that I need to print. What’s wrong with my script? (I’m not exactly an expert)