So the common way of changing to in-game animations like running and idle would be to copy paste the “Animate” script within each character and changing the values there. But what if I want to change these animations in game? My game is about hot potato, and I made a separate running animation for when a player has the potato. However, I tried to experiment with the “Animate” script to change the running animation, but nothing worked. How would I go about doing this?
1 Like
You can modify the animate script and add signals and event to control it from outside the script.
Directly modify the onRunning function and add an extra if statement depending on your custom state.
function onRunning(speed)
local movedDuringEmote =
userEmoteToRunThresholdChange and currentlyPlayingEmote and Humanoid.MoveDirection == Vector3.new(0, 0, 0)
local speedThreshold = movedDuringEmote and Humanoid.WalkSpeed or 0.75
if speed > speedThreshold then
local scale = char:GetAttribute("WalkSpeed") or 16.0
playAnimation("walk", 0.2, Humanoid)
setAnimationSpeed(speed / scale)
pose = "Running"
else --Add elseif holding potato
if emoteNames[currentAnim] == nil and not currentlyPlayingEmote then
playAnimation("idle", 0.2, Humanoid)
pose = "Standing"
end
end
end
How would I go about doing this? Sorry, I am a bit confused, and I don’t know how to implement it.