You can write your topic however you want, but you need to answer these questions:
What do you want to achieve? Keep it simple and clear!
I want to make it so you stand still while using Melee Attacks.
What is the issue? Include screenshots / videos if possible!
It does not work, and it may be a bit more difficult since it’s 3 Animations, not just one.
What solutions have you tried so far? Did you look for solutions on the Developer Hub?
I checked, but there is no solution for mine.
After that, you should include more details if you have any. Try to make your topic as descriptive as possible, so that it’s easier for people to help you!
local PlayerSpeed = script.Parent.Parent.Humanoid.WalkSpeed
function Movement(AnimationTrack, PlayerSpeed)
AnimationTrack:GetMarkerReachedSignal("ResumeMove"):Connect(function()
PlayerSpeed = 16
end)
AnimationTrack:GetMarkerReachedSignal("StopMove"):Connect(function()
PlayerSpeed = 0
end)
end
This is how it looks like ingame:
“fruitloop” is my displayname
“Behavior” is the script that should change the PlayerSpeed on Animation Events.
Those are my Animations, that should be compatible!
If you need any more detail, please ask!
I’m still very new to scripting! so please do criticize! and give feedback!
its fine! im just really confused why it does not work
i tried overwriting the animations, maybe they didnt apply the events or something.
but no success.
Connect it to when the animation is played. There’s an event that’s fired when an animation is played so you need to connect it to that, see: Using Animations - create.roblox.com.
However, you don’t need this in a function, you can just reference the animation and do those calculations from there, see the website linked above for more info about that.
You’re wrong. Variables only affect itself when changed (unless used as a debounce or bool). Just because you set a property of an Instance as a variable, doesn’t mean it affects the property if the variable is changed.
Look at this sample script:
local speed = Humanoid.WalkSpeed
print(speed) -- prints 16 (default)
speed = 32
print(speed) -- prints 32
print(Humanoid.WalkSpeed) -- prints 16 (default)
As you can see, changing the variable only changes the number of the variable speed for the rest of the script. It doesn’t change `Humanoid.WalkSpeed.
To actually change Humanoid.WalkSpeed, you must actually type that and set it to whatever speed you want.
The variable in your example is just speed, what he used is humanoid.WalkSpeed, changing the variable to that changes the walkspeed. You should read the code next time:
local variable = humanoid.WalkSpeed
variable = 32
print(humanoid.WalkSpeed)
--32