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)
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.
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
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
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”
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