#SOLVED Locating player's model in the workspace in a script

1 messages · Page 1 of 1 (latest)

rose creek
#

I'm just gonna try and make this as simple as possible. Can someone help me make a line of code that can locate the local player's model in the workspace? I have a tool that plays an animation when equipped and I'm trying to find a way to stop that animation with a button inside a gui. If you want context, feel free to ask, it a lot tho.
that's all, any help would be very helpfull

somber nimbus
#

If you have the local player you could get the character with
local character = player.Character or player.CharacterAdded:Wait()

rose creek
#

the script runs when a gui button is clicked and it's located in Playergui

somber nimbus
#

I think you need the actual animation track not the animation to stop it

odd auroraBOT
#

studio** You are now Level 11! **studio

somber nimbus
#

you can get all the running animations with animator:GetPlayingAnimationTracks()

#

so maybe something like this:

for i,v in character.Humanoid.Animator:GetPlayingAnimationTracks() do
v:Stop()
end

rose creek
#

okay, I'll try that, thank you 😭

somber nimbus
#

or you can maybe somehow check if its the correct animation and only then stop it

#

if you have the animation's name try this:

for i,v in character.Humanoid.Animator:GetPlayingAnimationTracks() do
if v.Name == "AnimationName" then
v:Stop()
end
end

rose creek
#

the solution was so simple this wole time

#

thank you so much 😭

somber nimbus
#

it worked?

#

nice you're welcome

rose creek
#

I was on the verge of another mental breakdown 😭

#

thank you so much!!!!!! 😭

somber nimbus
#

np