Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

how do i make walking on a specific part change your running animation?

im making a game with a LOT of ice and i want to make a custom running animation for running on the ice (r6 if you can) thanks in advance!

1 answer

✓ Accepted answer

You can detect what type of material a player is standing over with the FloorMaterial property. When that property changes to Ice you can change the animation. This script isn't perfect, but it works:

local plr = game.Players.LocalPlayer
local chr = plr.Character
local humanoid = chr.Humanoid

humanoid.Changed:Connect(function(property)
	if property == "FloorMaterial" and humanoid.FloorMaterial ~= Enum.Material.Air then
		if humanoid.FloorMaterial == Enum.Material.Ice then
			chr.Animate.walk.WalkAnim.AnimationId = "rbxassetid://5620305516"--your new animation id here
			chr.Animate.run.RunAnim.AnimationId = "rbxassetid://5620305516"--and here
		else
			chr.Animate.walk.WalkAnim.AnimationId = "rbxassetid://913402848"--Default animation IDs
			chr.Animate.run.RunAnim.AnimationId = "rbxassetid://913376220"
		end
	end
end)

2 comments

0

Forgot to mention this is a localscript placed in StarterCharacterScripts

1

ty

This discussion is preserved as it was. New answers, comments, and votes are closed.