Still have questions? Join our Discord server and get real time help.
Log in to vote
0

# How to you make a animation play on a dummy when you touch a part?

Asked by 2 months ago

I can't find information anywhere about this so I wanted to ask you guys to see if you know how to do it.

### 1 answer

Log in to vote
0
Answered by
Grazer022 131
2 months ago
Edited 2 months ago

you’re gonna have to use the Touched event using this

local Player = game.Players.LocalPlayer
local Character = Player.Character or Player.CharacterAdded:Wait()
local Dummy = game.Workspace.dummy

Dummy.Touched:Connect(function(hit)
if hit.Parent == Character:FindFirstChild(“Humanoid”) then
local Animation = Instance.new(“Animation”)
Animation.AnimationId = “animation id”
local humanoid = Character:WaitForChild(“Humanoid”)
local AnimationTrack = humanoid:LoadAnimation(Animation)
AnimationTrack:Play()
end
end)

0
Thank you. ExCaliberDen 3 — 2mo
0
ExCaliberDen the dummy should be what the dummy was called. And if this answered your question please make it an answer Grazer022 131 — 2mo
0
Yes it did, thank you. ExCaliberDen 3 — 2mo
0
oh ExCaliberDen 3 — 2mo
View all comments (54 more)
0
How do you make it show like that, to make it look like a script because i can't post everything. i think i"m doing it wrong. ExCaliberDen 3 — 2mo
0
what do you mean? Grazer022 131 — 2mo
0
Sorry im kinda new to coding so were do you set the animation to play during the script? ExCaliberDen 3 — 2mo
0
Also hit and humanoid are being registered as unknown even tough they aren't. ExCaliberDen 3 — 2mo
0
ohhh let me edit it Grazer022 131 — 2mo
0
Thank you, and if i have to ask you anything else i'm sorry. ExCaliberDen 3 — 2mo
0
ask me anything! Grazer022 131 — 2mo
0
Ok. ExCaliberDen 3 — 2mo
0
on the AnimationId, you should put the ID pf your animation Grazer022 131 — 2mo
0
of* Grazer022 131 — 2mo
0
Got it ExCaliberDen 3 — 2mo
0
Are these “ soused to be "? ExCaliberDen 3 — 2mo
0
I'm sorry again, but i touched the dummy and the script didn't work... ExCaliberDen 3 — 2mo
0
what does the error say? Check the output Grazer022 131 — 2mo
0
It doesn't show any errors, but it says something is wrong with this line local Character = Player.Character or Player.CharacterAdded:wait() ExCaliberDen 3 — 2mo
0
Got it. ExCaliberDen 3 — 2mo
0
tell me if there are more errors Grazer022 131 — 2mo
0
It still says there is something wrong with the same line. ExCaliberDen 3 — 2mo
0
did you put the right spaces, capitalization and spellings? Grazer022 131 — 2mo
0
also did you put local Character = Player.Character or Player.CharacterAdded:Wait() Grazer022 131 — 2mo
0
Put exactly what you put, and everything seemed to be capitalized. ExCaliberDen 3 — 2mo
0
Wait() Grazer022 131 — 2mo
0
oh ExCaliberDen 3 — 2mo
0
Did that but still seems to say that something on the line is wrong. ExCaliberDen 3 — 2mo
0
i used it on mine, works Grazer022 131 — 2mo
0
how ExCaliberDen 3 — 2mo
0
were do you put the script? ExCaliberDen 3 — 2mo
0
Wait did you change the “ to a " or do i keep it like “ ExCaliberDen 3 — 2mo
0
in StarterPlayerScripts using a Local Script Grazer022 131 — 2mo
0
Sorry still isn't working ExCaliberDen 3 — 2mo
0
also yes change the quotation marks Grazer022 131 — 2mo
0
well did that didn't work, but it's saying it can't find the value of local Dummy = game.Workspace.dummy ExCaliberDen 3 — 2mo
0
did you put in the name of your dummy? instead of putting dummy Grazer022 131 — 2mo
0
would i have to switch everything that is dummy to whatever the name is? ExCaliberDen 3 — 2mo
0
no just change this, local Dummy = game.Workspace.[name of your dummy] Grazer022 131 — 2mo
0
Oh ok ExCaliberDen 3 — 2mo
0
can you update the script to show me what your's looks like? ExCaliberDen 3 — 2mo
0
ok done Grazer022 131 — 2mo
0
FindFirstChild, and WaitForChild are switched. ExCaliberDen 3 — 2mo
0
yeah Grazer022 131 — 2mo
0
oh ExCaliberDen 3 — 2mo
0
we have reached 40+ comments Grazer022 131 — 2mo
0
How is yours working and mine not? ExCaliberDen 3 — 2mo
0
World record. ExCaliberDen 3 — 2mo
0
idk. I just typed it Grazer022 131 — 2mo
0
i don't know what the problem is considering yours works and I did exactly what the script was so do you want to give up? ExCaliberDen 3 — 2mo
0
im so sorry if i couldn’t help you. But feel free to ask more questions Grazer022 131 — 2mo
0
Its ok and sure. ExCaliberDen 3 — 2mo
0
anything else? Grazer022 131 — 2mo
0
50 COMMENTS! Grazer022 131 — 2mo
0
Nothing. ExCaliberDen 3 — 2mo
0
Also 3 hours wasted out of our life. ExCaliberDen 3 — 2mo
0
Well i did learn more so i guess it wasn't wasted. ExCaliberDen 3 — 2mo
0
guys lets try to get the most commented section ever Coperncius 0 — 2mo