✓ Accepted answer
- What is onEnter?
- FindFirstChild is a function, not a property
- You can't just say StarterPack.
- You need to load the animation in the humanoid
- Functions need "()"s at the end.
I'm guessing onEnter means when the player enters. So we use PlayerAdded.
game.Players.PlayerAdded:connect(function(player)
print(player.Name)
end)
FindFirstChild is a function,
game.StarterPack:FindFirstChild()
You cannot say StarterPack by itself as if it's script or game.
game.StarterPack
game:GetService("StarterPack")
You need to load the animation first.
workspace.Player1.Humanoid:LoadAnimation(animation)
Functions like "play" need "()"s at the end.
animation:play()
Now we add this all together
game.Players.PlayerAdded:connect(function(player)
player.CharacterAdded:connect(function(character)
local script = game.StarterPack.LocalScript
if character:FindFirstChild("Humanoid") then
local animation = Instance.new("Animation")
animation.AnimationId = "http://www.roblox.com/Asset?ID=222080965"
local animtrack = character.Humanoid:LoadAnimation(animation)
animtrack:play()
end
end)
end)
Hope this helps!
2 comments
Thanks Dude :D
You're welcome.