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
#SOLVED Locating player's model in the workspace in a script
1 messages · Page 1 of 1 (latest)
If you have the local player you could get the character with
local character = player.Character or player.CharacterAdded:Wait()
Omg right, I completly forgot, I have a problem tho. When a tool is equipped it gets added to the player's model in the workspace. inside the tool there's a script, and inside is an animation track, and for some reason when I use the :Stop() command, it does not work. Do you know why it's happening?
the script runs when a gui button is clicked and it's located in Playergui
I think you need the actual animation track not the animation to stop it
** You are now Level 11! **
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
okay, I'll try that, thank you 😭
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
OMGGG 😭
the solution was so simple this wole time
thank you so much 😭
np