#Need help with making a script

1 messages · Page 1 of 1 (latest)

slim python
#

I need help making a script where you can chop a tree down, after breaking it, it'll give you wood, you can then sell for money. I have no idea where to begin. I've only been using studio for around 5-6 days so I'm new to absolutely everything. Any help is greatly appreciated❤️🙏🏻

glad moth
#

hey!

#

first

#

for the falling animation

#

(if you want to fall in the first place)

#

you could do mmmh wait

#

lemme open studio

#

first you gotta make the axe

#

here i have the axe tool

#

to make it

#

you gotta do this

#

first, obvyously model the axe with parts

#

then

#

when you already have the model you want (per example this is mine)

#

you'll have to go to the Model tab

#

click the Weld button

#

and select both parts

#

it should look like this

#

now you'll have to create the tool

#

(for now, create it in StarterPack)

#

it should look like this (i forgot to put an image here but i'm too lazy to put one now)

#

now, move all the parts of your axe into the tool

#

(they will "dissapear", dw, it's normal)

#

now, change one of the parts' name to Handle (exactly like that), also, make sure you only change one of the parts' name to Handle , you should also change specifically the grip's name to Handle but that's not necessary

#

now test it!

#

you'll see that you're equipping it!

#

now, if you don't feel pleased with the way you're grabbing it

#

(per example here my character is holding it backwards)

#

you might want to go to the toolbox (go to the Home tab, and click the Toolbox icon)

#

and search something along the lines of "tool grip editor"

#

you'll find many plugins, any of these is generally good, but for the sake of this tutorial select the one i use, which is the one called stravant - GripEdit (Tool Grip Editor)

#

so now that you have that plugin

#

you should be able to find it in the Plugins tab

#

as you can see here

#

so you gotta click it

#

and you should see this gui here

#

select your tool

#

and this rig will appear

hot sirenBOT
#

studio** You are now Level 9! **studio

glad moth
#

it's pretty self-explanatory, you just move the tool once you're satisfied with it

#

(example)

#

now just click the "Close GripEdit" button in the GUI

#

test again, and it should work well!

#

now, we have the tool, but we need some trees!

#

here's a lil tree i made just to test this

#

i'd recommend putting that tree model in a model instance if you haven't yet

gloomy shale
#

is bro making a full tutoiral

glad moth
#

yes 💀 i'm genuinelly so bored

#

you should also weld all of the parts in you tree model the same way you did with the tool

#

(this is for physics purposes i'll explain later, it's for the falling animation)

#

you might also want to anchor it so that it doesn't get affected by physics

#

it is in the properties tab, there's a boolean value (true or false) that you can change by clicking in the square next to it

#

you should change the anchored property to true for all of the parts in your model

#

now you have a tree AND an axe 0:

#

now, the next thing we should do is uhmmm

#

well, scripting the axe!

#

to do this, first, you should insert a LocalScript inside your axe tool

#

delete that print("Hello World"), and let's start scripting!

#

(actually nvm, first we should make the animation)

#

don't delete that local script tho

#

sooo anyways, to animate stuff

#

go to the Avatar tab

#

(it should look like this)

#

click the Character icon

#

you should see this, it's pretty self explanatory, just select what you want, but as i'm not really a good animator and this is just a tutorial i'll go for R6

#

(wait afk, brb)

#

ok, im back

#

so, now you should have your rig!

#

(example)

#

what will do you with that rig, you might be wondering?

#

well, this rig is what we'll use for the axe swing animation!

#

to do this, click the Clip Editor button in the Avatar tab

#

you should see this!

#

so, do what the text says! you have to select the rig you just created

#

once you do that, it should look like this

#

this is the Animation Editor

#

here you... well, edit animations!

#

i'm actually too lazy (and stupid) to correctly explain how it works as i'm lowk not an animator but

#

but i actually think the best way to learn animating is just... doing animations!

#

so first, the blue line you see tells you which frame you are editting

#

each gray line is a frame

#

so, let's start making the animation

#

first the arm goes up

#

and then it goes down

#

now, what you should do is

#

see the three dots?

#

click them

#

you should see this

#

select "Publish to Roblox"

#

you'll see this, you can change anything you want here, but i'd recommend not toggling Delete Local Instances

#

now click save and you should see this

#

click close

#

click the X on the Animation Editor

#

it should look like this

#

now, go to the Home tab

#

click the Toolbox icon

#

and click the lightbulb icon

#

oh sorry i gtg

#

i might continue this tutorial later

#

👋

slim python
#

holy bro, im sorry i havent been active for a couple of hours, youre actually the goat for giving me a whole step by step tutorial, thank you so so so much bro

#

thats actually insane, youre goated

glad moth
#

k

#

i'm back!

#

so, as i said

#

you gotta click that lightbulb icon in the toolbox

#

select Animations

#

and you should see the animation you just made

#

example of animations being there (i'm not an animator i don't have a lot of these)

#

so you gotta right click the one you're gonna use

#

and select Copy Asset ID

#

now, you can close the toolbox if you want to

#

and you'll have to

#

insert an Animation instance in your axe tool

#

in it's properties, specifically in the Data section, you'll see a property called AnimationId

#

paste the asset ID of the animation you just made there

#

now, finally, we'll get to scripting

#

first, create a LocalScript inside your axe tool if you didn't yet

#

then double click the LocalScript

#

you should see this

#

now, we'll have to create an Animator in our script

#

you don't have to know what it is for now, you can just copy what i write

#

local animator = Instance.new("Animator", script.Parent)

#

(actually imma just write the whole code and give you it after i finished it)

#

alr

#
local players = game:GetService("Players")
local player = players.LocalPlayer
local character = player.Character or player.CharacterAdded:Wait()
local humanoid = character:WaitForChild("Humanoid")
local animator = Instance.new("Animator", humanoid)

tool.Activated:Connect(function()
    animator:LoadAnimation(tool.swing):Play()
end)```
#

it took me harder than i'd like to admit, i hate working with animations

#

now, you can test it! you should see that the animation runs when you click

#

but we still need to be able to chop the trees down with our axe

#

to do this, we'll have to write more stuff in this localscript and do other stuff

#

but imma tell you all that once i finish the script for it

#

wait i didn't know making tutorials was ts hard

#

actually imma go do other stuff

#

i might continue this later