This will make the player freeze.
Freeze then and will stop Animation.
wait…so anchoring will or will not allow my animations to play?
I’m not sure, I do that all the time, and it works fine for me.
do i just replace
Character.HumanoidRootPart = true
with humanoid.walkspeed?
-- idk what that wait is but use task.Wait if your going to use wait
local player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local Humanoid = Character.Humanoid
local animations = {
Animation1 = Player.Humanoid:LoadAnimation(script.Slices),
Animation2 = Player.Humanoid:LoadAnimation(script.Spin),
Animation3 = Player.Humanoid:LoadAnimation(script.BackFlipStab),
Animation4 = Player.Humanoid:LoadAnimation(script.DownSlice)
}
local canFly = true
local function giveAnimation()
local Fly = math.Random(1,5)
if canFly then
local animation = animations[fly]
canFly = false
animation:Play()
humanoid.Walkspeed = 0
humanoid.JumpPower= 0
task.Wait(0.5)
humanoid.Walkspeed = 16 -- or whatever the orginal values are
humanoid.JumpPower= 50
canFly = true
end
end
script.Parent.Parent.Activated:connect(giveAnimation)
yes you do. It’ll make the animation still work while freezing the player.
Hmm…Interesting.
I tried to use teh code with Tool animation and it no work.
Maybe I will be more carefull next time.
The animations wont play with this code for some reason. The script is inside the handle so idk if that is causing anything.
I tried it but with no luck…for some reason the animations just wont play.
yeah im having trouble getting the animations to play to play.
there is a bug in the script rn it is
local animations = {
Animation1 = Player.Humanoid:LoadAnimation(script.Slices),
Animation2 = Player.Humanoid:LoadAnimation(script.Spin),
Animation3 = Player.Humanoid:LoadAnimation(script.BackFlipStab),
Animation4 = Player.Humanoid:LoadAnimation(script.DownSlice)
}
it should be
local animations = {
Player.Humanoid:LoadAnimation(script.Slices),
Player.Humanoid:LoadAnimation(script.Spin),
Player.Humanoid:LoadAnimation(script.BackFlipStab),
Player.Humanoid:LoadAnimation(script.DownSlice)
}
along with that it should be math.random(1,4)
but then how would i play each on animation
Animation1:Play()
this line wouldnt work anymore if i did that
since its a array it actually looks like
[1] = Player.Humanoid:LoadAnimation(script.Slices),
[2] = Player.Humanoid:LoadAnimation(script.Spin),
[3] = Player.Humanoid:LoadAnimation(script.BackFlipStab),
[4] = Player.Humanoid:LoadAnimation(script.DownSlice)
VS.
Animation1 = Player.Humanoid:LoadAnimation(script.Slices),
Animation2 = Player.Humanoid:LoadAnimation(script.Spin),
Animation3 = Player.Humanoid:LoadAnimation(script.BackFlipStab),
Animation4 = Player.Humanoid:LoadAnimation(script.DownSlice)
--so what animations[fly] does is searches through the table to find the value (or the thing on the right side) based on a random number 1-4 , my first result looks at the left side that isn't numbers and gets confused, so if the table looks like the top result when it searches through numbers it finds the number it equals and sets the animation to that. if you dont get what i mean look at https://developer.roblox.com/en-us/articles/Table
btw dont set the table to
[1] = Player.Humanoid:LoadAnimation(script.Slices),
[2] = Player.Humanoid:LoadAnimation(script.Spin),
[3] = Player.Humanoid:LoadAnimation(script.BackFlipStab),
[4] = Player.Humanoid:LoadAnimation(script.DownSlice)
its just an example of what it looks like when you print
Player.Humanoid:LoadAnimation(script.Slices),
Player.Humanoid:LoadAnimation(script.Spin),
Player.Humanoid:LoadAnimation(script.BackFlipStab),
Player.Humanoid:LoadAnimation(script.DownSlice)
This is a bit out of my league at the moment lol so is this the right thing to do/
-- idk what that wait is but use task.Wait if your going to use wait
local Player = game:GetService("Players").LocalPlayer
local Character = Player.Character
local Humanoid = Character.Humanoid
local animations = {
Player.Humanoid:LoadAnimation(script.Slices),
Player.Humanoid:LoadAnimation(script.Spin),
Player.Humanoid:LoadAnimation(script.BackFlipStab),
Player.Humanoid:LoadAnimation(script.DownSlice)
}
local canFly = true
local function giveAnimation()
local Fly = math.Random(1,5)
if canFly then
local animation = animations[fly]
canFly = false
animation:Play()
Humanoid.Walkspeed = 0
Humanoid.JumpPower= 0
task.Wait(0.5)
Humanoid.Walkspeed = 16 -- or whatever the orginal values are
Humanoid.JumpPower= 50
canFly = true
end
end
script.Parent.Parent.Activated:connect(giveAnimation)
I think that is right, I think I made tables seem way more complex than they are read this:
Hm…i must be doing something wrong because the animations won’t seem to play.
also (fly) generates an error. unknown global error
If you anchor any parts of the character model (especially HumanoidRootPart), your animations won’t play. I would suggest you to just set the walkspeed and jump power of the humanoid both to 0.