Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How can make a different running animation when I carry a specific weapon?

Asked by 7 years ago

I'm trying to create a weapon script that has a running animation (and I was also thinking of adding some idle animations, but I'm going to get this working first then add those later). I only want this animation to play ONLY when you have the weapon equipped, I don't want to make the animation play when the players join the game. I have a basic script already made, but it says "character is not a valid member of model" The reason I want to make this animation on JUST this weapon, is because i don't want these animations to be on every character that joins the game. I know how to add weight values and I know how to import the animations, I just don't know how to actually make the animations work while the character is holding the weapon.

All of this was put into a local script into my actual tool



---------------------------------------------------------------------- ------------------------------All the locals------------------------ ---------------------------------------------------------------------- local tool = script.Parent local canplay = true local character = game:GetService('Players').LocalPlayer local player = character.Character or character.CharacterAdded:wait() ---------------------------------------------------------------------- ---------------Importing animaton/creating the int value--- ---------------------------------------------------------------------- local int = Instance.new("IntValue") int.Name = "Seven" local animation = Instance.new("Animation") animation.AnimationId = "http://www.roblox.com/Asset?ID=619848002" ---------------------------------------------------------------------- tool.equipped:connect(function() int.Value = 1 print(int.Value) end) tool.unequipped:connect(function() int.Value = 0 print(int.Value) end) tool.equipped:connect(function(mouse) mouse.Button1Down:connect(function() print("Lol hi") end) end) ---------------------------------------------------------------------- -------------------------Actual (Broken) animation code----- ---------------------------------------------------------------------- repeat wait() until int.Value == 1 if int.Value == 1 then while not player.Character do wait() end local character = player.Character local animateScript = character.Animate animateScript.walk.animation.AnimationId = "http://www.roblox.com/Asset?ID=619848002" end

I basically made it so that the script creates a new int value then checks if that int value is 1 and if it is it should replace the character's walking animation. I might have another follow up question on how to add idle animations, but i have to get done with this one first lol.

0
oh, when I equip this weapon for the first time, it says "Character is not a valid member of Plugin" Sparkflyer34 40 — 7y

Answer this question