Hey! I’m trying to script a stand (Quick explanation if you don’t know what it is: “A ghost that is floating behind you.”)
I welded him to my humanoidRootPart and now I want him to do an animation, but he isn’t. I don’t really know how to fix that. Here is the code:
function Abilities.Appear(plr)
local character = plr.Character or plr.CharacterAdded:Wait()
local humanoid = character.Humanoid
local zaWarudo = replicatedStorage["Za Warudo"]:Clone()
zaWarudo.Parent = workspace
zaWarudo.HumanoidRootPart.CFrame = character.HumanoidRootPart.CFrame * CFrame.new(2, 1, 3)
local weld = Instance.new("WeldConstraint")
weld.Part0 = character.HumanoidRootPart
weld.Part1 = zaWarudo.HumanoidRootPart
weld.Parent = workspace
local animationTrack = zaWarudo.Humanoid:LoadAnimation(Animation)
animationTrack:Play()
end
It all works fine, he gets behind my back and stuff but the animation doesn’t play. Here is how his character looks like
Should be a R15 character. The animation is R15 too.
Thanks!
Your code wouldn’t run because it is a local function, call the function from the module with a script. Your character is in replicated storage so you wouldn’t even see if the character did the animation. I rather you use a actual dummy.
EDIT: The animation also won’t run if the character is anchored
I’m calling the function from the Server. Basically I have a Remote that fires to the server whenever the player presses a key. Here is the receive thing
local Remote = game:GetService("ReplicatedStorage").Remotes.Pressed
local canNotDo = {}
local StandHandler = require(script.Parent.TheWorldAbilities)
Remote.OnServerEvent:Connect(function(player, input)
if table.find(canNotDo, player.Name) then return end
if input == Enum.KeyCode[StandHandler.TimeStopKey] or input == "Mobile" then
table.insert(canNotDo, player.Name)
StandHandler.StopTime(player.Name)
wait(StandHandler.Hold)
StandHandler.ResumeTime(player.Name)
wait(StandHandler.Cooldown)
table.remove(canNotDo, table.find(canNotDo, player.Name))
elseif input == Enum.KeyCode[StandHandler.SpawnKey] then
StandHandler.Appear(player)
end
end)
This part
elseif input == Enum.KeyCode[StandHandler.SpawnKey] then
StandHandler.Appear(player)
end
Should I call it from a Local Script or what do you mean?
It has to be welded to the character or it wouldn’t make sense. It should be a stand (Quick explanation if you don’t know what it is: “A ghost that is floating behind you.”)
What do you mean I changed the HumanoidRootPart CFrame? I changed the Stand’s HumanoidRootPart CFrame so it’s behind me. After that I welded him to my HumanoidRootPart.
I saw a video where someone welded something to his HumanoidRootPart and it could still play animations with an AnimationController so I don’t think that’s the problem.
local anim = script.Parent:WaitForChild("Animation")
script.Parent:WaitForChild("Humanoid"):LoadAnimation(anim):Play()
This is not the full code, and make sure to insert an Animation into your NPC, don’t forget to paste the ID inside, also make sure that the body parts aren’t anchored!
I do not recommend welding the stand to the player, it makes less room for functionality such as attacks, (barrages, blocks). The method I use in my jojo games involve using AlignPosition and Orientation. Simply place an AlignPosition and AlignOrientation inside the humanoidRootPart of your stand, and create an attachment in the middle of the HumanoidRootPart, parented to the HRP. Place another attachment in the players HumanoidRootPart, and then set the attatchment1 property of the alignPosition and Orientation to the attachment in the player. Adjust the player attachment position accordingly, and then you have a stand.