URGENT HELP NEEDED PLEASE HELP! "School project"

So I have a script that I’m using from a youtuber, I would like some ideas of the best way to edit this script without making the script change its original purpose/goal, I want the animation to be my own custom animation instead of the default animation that’s provided with the string value, and just replace it with the custom animation so that it still does what the script is asking.

I have tried one way but unfortunately I couldn’t find any other solutions.

I have tried changing the script so that instead of saying “string value” for the tool, I removed it so it just identifies the custom animation and then it sends it to the parent but it didn’t work, that’s all I could think of.

> NOTICE!!!
This script is going towards a school project and I’m really excited for the result and to publish my game onto Roblox. I have always wanted to design games with ROBLOX and have been for 2 years now but I still need knowledge and training in scripting as I usually use YouTube and mirror scripts from there to my game. It means a lot to me and would mean a lot if you guys can help.

local tool = script.Parent

local swing = true



tool.Handle.Touched:Connect(function(otherPart)

	if otherPart.Name == 'Rock' then

		wait()

		tool.Mining.Value = false

	end

end)





local function mine()



	if swing then

		swing = false

		tool.Mining.Value = true

		local str = Instance.new("StringValue")

		str.Name = "toolanim"

		str.Value = "Slash"

		str.Parent = tool

		wait(0.5)

		swing = true

		tool.Mining.Value = false

	else 

		return

	end

end



tool.Activated:Connect(mine)
2 Likes

I don’t see any animation ID in your script. Perhaps the animation thing is processed in another script?

Is this script a localscript or a serverscript? I dont see any animation ID in your script aswell.

its the correct script, just use a random number for the anim or just say animation in between the * symbols, and its a basic script in a tool unless that’s what a server script is but yeah just a basic script without the person on the icon.

Also, if the string value is supposed to be an animation ID then it should bE rbxassetid://animationid

You put the “animationid” as your animation ID incase you didn’t get it,

1 Like

no but the youtuber had it so that the tool anim provided in the script already, is the default animation stored inside the systems of roblox, this is a raw script straight from the youtuber

Can you give me the link of the YT video so i can understand more?

I’m confused, there’s no signs of an animation playing in the script.

Im confused aswell. asdasdasdas

I’m suggesting you to watch this video: Advanced Roblox Scripting Tutorial #14 - Animation (Beginner to Pro 2019) - YouTube
This will give you some knowledge on how to play an animation with your custom ID.

ok so go to the 3:16 point on the video, and although the script isn’t the same as the video if you scroll down the youtuber has commented an edited version of the script and that’s the one I am using.

also there is an animation there its just the roblox stored/ created animation, the video will explain it if you rewind it to where he starts writing the tool script

Watch my video up there, it will solve your problem.

Just curious, have you fully watched the video?
Are you sure you’ve done everything right?

i dont think you understand i havnt even got an animation in the script in my game and its playing the default swing animation that is stated with the string value its the “toolanim”

oh wait is the script talking about the value in the tool its self??

local function mine()
 if not tool:FindFirstChild("ANIMATIONNAME") then
   local animation = Instance.new("Animation")
   animation.Value = "rbxassetid://YOURANIMATIONIDHERE"
   animation.Name = "ANIMATIONNAME"
   animation.Parent = tool

   local plr = game.Players:GetPlayerFromCharacter(tool.Parent)
   local hum = plr.Character.Humanoid
   local animator = hum:WaitForChild("Animator")
   local animation = animator:LoadAnimation(animation)

   animation:Play()
   tool.Mining.Value = true
   task.wait(waitTime)
   tool.Mining.Value = false
   animation:Stop()
   end
end

Basically since its a roblox stored animation, this is a example of how to make a custom animation play

OH, the value of the Stringvalue made it do an automated animation, sorry about that.

keep in mind this is pseudo code.