Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

How to make an audio, animation and an ontouch damage script play on keydown?

Asked by 8 years ago
pl = game.Players.LocalPlayer
mouse = pl:GetMouse()
hum = pl.Character:findFirstChild('Humanoid')

mouse.KeyDown:connect(function(v)
if v == "k" then
local y = Instance.new('Sound', pl.Character.Torso)
y.SoundId = "www.roblox.com/Asset?ID=136007472"
y:Play()
local a = Instance.new("Animation")
a.AnimationId = "www.roblox.com/Asset?ID=306980150"
local at = hum:LoadAnimation(a)
at:Play()
pl.Character['Body part'].Touched:connect(function(hit)
local hittarget = hit.Parent:findFirstChild("Humanoid")
if hittarget and hittarget.Name ~= pl.Name then
hittarget:TakeDamage(10)
end
end)
end
end)

The title says it all, how can I make one or atleast fix my script?

0
bump issacex1994 0 — 8y

Answer this question