Hi everyone,
I’m currently working on an Attack on Titan game, and I’ve implemented a system for shifting into a Titan. However, I’m encountering an issue with the animations (or possibly something else—I’m not entirely sure where the problem lies).
Sometimes (not always), when the player unshifts back to human form, the character’s arms end up in a strange position:
Here are the two animations I’m using:
-
Hand Bite Animation:
-
Unshift Animation:
The key script responsible for the Titan shifting system is quite complex. It changes the character model, loads new characters, uses a lot of task.wait
calls, and involves other intricate logic. I’ve included the script below for reference:
-- The shifting script is detailed here
local ShiftEvent = game:GetService("ReplicatedStorage").Function.Shift
local EffectFolder = game:GetService("ServerStorage").Effect
local ShiftEffectF = EffectFolder.Shift
local titanModel = game:GetService("ServerStorage").Titan
local Players = game:GetService("Players")
local RunService = game:GetService("RunService")
local TransformationEffect = game:GetService("Lighting").Transformation
ShiftEvent.OnServerInvoke = function(plr:Player)
local ShiftValue:BoolValue = plr:FindFirstChild("Shift")
local CanChange:BoolValue = plr:FindFirstChild("CanChange")
if not CanChange.Value then
return
end
if not ShiftValue.Value then
CanChange.Value = false
local char = plr.Character
local hum:Humanoid = char.Humanoid
local hrp:Part = char.HumanoidRootPart
local animator:Animator = hum.Animator
local titan = titanModel:Clone()
local AT = animator:LoadAnimation(script.HandBite)
AT:Play()
AT:GetMarkerReachedSignal("End"):Connect(function()
for i, effect in ShiftEffectF:GetChildren() do
local newEffect = effect:Clone()
newEffect.Parent = char:FindFirstChild("UpperTorso")
end
end)
AT.Stopped:Wait()
AT:Stop()
local Lightning = EffectFolder.Lightning:Clone()
local TransformationSound = EffectFolder.Transformation:Clone()
TransformationSound.Parent = Lightning
TransformationSound:Play()
hrp.Anchored = true
plr.CameraMinZoomDistance = 100
Lightning:PivotTo(char:GetPivot())
Lightning.Parent = workspace
titan:FindFirstChild("Controlled").Value = true
titan:PivotTo(char:GetPivot())
task.wait(1.5)
titan.Parent = workspace
Lightning:Destroy()
plr.CameraMinZoomDistance = 10
plr.Character = titan
ShiftValue.Value = true
CanChange.Value = true
return titan
else
CanChange.Value = false
local titan = plr.Character
local humT:Humanoid = titan.Humanoid
local animatorT:Animator = humT.Animator
local hrpT:Part = titan.HumanoidRootPart
local AT = animatorT:LoadAnimation(script.Unshift)
hrpT.Anchored = true
AT:Play()
AT:GetMarkerReachedSignal("End"):Connect(function()
AT:AdjustSpeed(0)
end)
AT:GetMarkerReachedSignal("End"):Wait()
plr:LoadCharacter()
titan = titan:Clone()
humT = titan.Humanoid
animatorT = humT.Animator
hrpT = titan.HumanoidRootPart
titan:FindFirstChild("Controlled").Value = false
titan.Parent = workspace
RunService.Heartbeat:Wait()
animatorT = titan:FindFirstChild("Humanoid").Animator
AT = animatorT:LoadAnimation(script.Unshift)
AT:Play()
AT.TimePosition = AT.Length * 0.9
AT:AdjustSpeed(0)
local char = plr.Character
local hum:Humanoid = char.Humanoid
local animator:Animator = hum.Animator
local hrp:Part = char.HumanoidRootPart
local weld = Instance.new("WeldConstraint")
char:PivotTo(titan.VitalPoint.CFrame)
weld.Parent = titan.VitalPoint
weld.Part0 = titan.VitalPoint
weld.Part1 = hrp
hum.PlatformStand = true
titan.VitalPoint.Smoke.Enabled = true
task.wait(2)
weld:Destroy()
titan.VitalPoint.Smoke.Enabled = false
hum.PlatformStand = false
humT:Destroy()
ShiftValue.Value = false
CanChange.Value = true
end
end
This is what it looks like in-game when the player shifts and unshifts:
View Animation Example
Does anyone have any suggestions on how to troubleshoot or fix this issue?
I suspect that it might be related to:
- Animations not resetting properly.
- Issues with the character rig or welds during the transition.
Any insights or advice would be greatly appreciated! Thanks in advance.