#How do i access a variable in a function?

23 messages · Page 1 of 1 (latest)

mellow cipher
#

Hello man

#

you can use the KeyframeReached event of the AnimationTrack object

#

u can use this event to trigger custom behavior at specific points in the animation

#

as for accessing variables in a function, you can do this by defining the variable outside of the function

#

for example:

local myVariable = 0

local function myFunction()
    myVariable = myVariable + 1
end
#

u can now access it from other scripts aswell

mellow cipher
#

what

#

The animation object

#

Like there u need the path to it

#

uh

#

its like

#

the animation

#

u have

#

u need write it there

woven canopyBOT
#

studio** You are now Level 4! **studio

mellow cipher
#

uh

#

now u made my brain hurt too

alpine brook
#

what's the error? show the script

alpine brook
#

have you tried saving animations in ReplicatedStorage instead?

#

it's easier. you can just put it there with all the properties and just call it in the script

#

also, maybe KeyFrameReached is typed wrong or something. I don't know really, I never used that event

#

usually, I just put a wait to the time I want instead of waiting for a note in the animation