I’m trying to make a script that when a player equips a tool it increases their speed and makes an animation play. So far I was able to increase the player’s speed when they equip it. This is what the tool looks like:
With that in mind, this is what I want it to look like:
Here is the script I made, but I couldn’t get it to play the animation, and stop it when they are no longer equipping it:
local p = game:GetService("Players").LocalPlayer
local char = p.Character or p.CharacterAdded:Wait()
local hum = char:WaitForChild("Humanoid")
local defaultSpeed = hum.WalkSpeed
local customSpeed = 00
local Tool = script.Parent
Tool.Equipped:Connect(function()
hum.WalkSpeed = customSpeed
end)
Tool.Unequipped:Connect(function()
hum.WalkSpeed = defaultSpeed
end)
What @FruitySama said is correct, but assuming that you will be using this animation only if the character is underwater, you will need to use humanoid:GetStatus() to check if the status is Swimming.
You can make two different animations (an r15 and r6) and play one of those animations depending on if the local player is using r6 or r15. Personally, I would just force players to use r15 in game settings as it’s far less work.