#Anim Play at touching part
100 messages · Page 1 of 1 (latest)
unless that's an npc
ofc
if Mary.TouchDetector.Touched then
touched is an event
this is a very odd way to code this, what's your setup?
I'm really bad at scripting- I don't know really about it
** You are now Level 2! **
I mean, it will evaluate to true, so unless that's not an npc
Im trying make when player touches the part inside her she plays animation
it should work
AH
yeah
that will totally not work
let's go over why first
local Mary = game.Workspace.Mary
if Mary.TouchDetector.Touched then
Mary.Humanoid.Animator:LoadAnimation(Mary.Stand):Play()
if Mary.Stand.IsPlaying == true then
Mary.Stand.Looped = true
end
end
that code will run exactly once
inmediately after you clicked the run button
the script then will proceed to commit suicide
literally
if you want the script to not die
you have to connect to the event!
How i do that-
local TouchDetector = workspace.TouchDetector
TouchDetector.Touched:Connect(function(touchedPart)
end)
second thing
local Mary = game.Workspace.Mary
remember I said that the script will run inmediately?
oh
OOH-
so you gotta get the player from the touched part
omg ty
you cannot just fetch it from the workspace basically
but you can go from here
and noo worries
ez way to get the player from the touched part
I can do this?
local Mary = script.Parent
nope
oh
is mary the parent of the script?
yeah
wait what?
and the aprent of the detector
isn't mary your character?
its a skinned mesh npc
huh
yeah-
kk
okay so you have your character in workspace
to play with it around ig
literally a model of your character
mary
yeah
its like-
player touches the detector
then she plays anim
Oh lmao
then yeah absolutely
local TouchDetector = workspace.TouchDetector
local Mary = script.Parent
TouchDetector.Touched:Connect(function(touchedPart)
Mary.Humanoid.Animator:LoadAnimation(Mary.Stand):Play()
end)
should do it?
okay. that is very lol
right...
we are not checking anything
heehh
we still gotta check if a player touched her (oh no)
yeah but the code will trigger for absolutely antything that touches mary
including the baseplate
we are not discriminating, basically
local Players = game:GetService("Players")
local TouchDetector = workspace.TouchDetector
local Mary = script.Parent
TouchDetector.Touched:Connect(function(touchedPart)
local Character = touchedPart.Parent
if not Character then return end
local Player = Players:GetPlayerFromCharacter(Character)
if not Player then return end
Mary.Humanoid.Animator:LoadAnimation(Mary.Stand):Play()
end)
still not debouncing so the animation could play many times
Help she just dissapears when play
oh
sorry- i tried the other and now i see the edit
oh
kk
she stills dissapearing rip
fr
is she anchored or is she set non collidable?
shes not anchored
and you can collide
i will try with another model
probably its a model problem ig