Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
COMMUNITY QUESTION

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

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

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)

58 comments

0

Thank you.

0

ExCaliberDen the dummy should be what the dummy was called. And if this answered your question please make it an answer

0

Yes it did, thank you.

0

oh

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.

0

what do you mean?

0

Sorry im kinda new to coding so were do you set the animation to play during the script?

0

Also hit and humanoid are being registered as unknown even tough they aren't.

0

ohhh let me edit it

0

Thank you, and if i have to ask you anything else i'm sorry.

0

ask me anything!

0

Ok.

0

on the AnimationId, you should put the ID pf your animation

0

of*

0

Got it

0

Are these “ soused to be "?

0

I'm sorry again, but i touched the dummy and the script didn't work...

0

what does the error say? Check the output

0

It doesn't show any errors, but it says something is wrong with this line local Character = Player.Character or Player.CharacterAdded:wait()

0

Got it.

0

tell me if there are more errors

0

It still says there is something wrong with the same line.

0

did you put the right spaces, capitalization and spellings?

0

also did you put local Character = Player.Character or Player.CharacterAdded:Wait()

0

Put exactly what you put, and everything seemed to be capitalized.

0

Wait()

0

oh

0

Did that but still seems to say that something on the line is wrong.

0

i used it on mine, works

0

how

0

were do you put the script?

0

Wait did you change the “ to a " or do i keep it like “

0

in StarterPlayerScripts using a Local Script

0

Sorry still isn't working

0

also yes change the quotation marks

0

well did that didn't work, but it's saying it can't find the value of local Dummy = game.Workspace.dummy

0

did you put in the name of your dummy? instead of putting dummy

0

would i have to switch everything that is dummy to whatever the name is?

0

no just change this, local Dummy = game.Workspace.[name of your dummy]

0

Oh ok

0

can you update the script to show me what your's looks like?

0

ok done

0

FindFirstChild, and WaitForChild are switched.

0

yeah

0

oh

0

we have reached 40+ comments

0

How is yours working and mine not?

0

World record.

0

idk. I just typed it

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?

0

im so sorry if i couldn’t help you. But feel free to ask more questions

0

Its ok and sure.

0

anything else?

0

50 COMMENTS!

0

Nothing.

0

Also 3 hours wasted out of our life.

0

Well i did learn more so i guess it wasn't wasted.

0

guys lets try to get the most commented section ever

This discussion is preserved as it was. New answers, comments, and votes are closed.