im trying to do a impact sound effect but i dont know how or where to put it

do i put it here ?

Punch script

math.randomseed(tick())

local ReplicatedStorage = game:GetService("ReplicatedStorage")
local punchEvent = Instance.new("RemoteEvent", ReplicatedStorage)
punchEvent.Name = "PunchEvent"

local animations = {2729957815, 2733095250, 2734153485}

local function onPunchFired(plr)
	local char = game.Workspace:FindFirstChild(plr.Name)
	local humanoid = char.Humanoid
	local animation = Instance.new("Animation")
	local picked = math.random(1, #animations)
	animation.AnimationId = "http://roblox.com/asset/?id="..animations[picked]
	local animTrack = humanoid:LoadAnimation(animation)
	animTrack:Play()
	local dmgScript = script.DmgScript:Clone()
	if picked == 1 then
		dmgScript.Parent = char.RightHand
	elseif picked == 2 then
		dmgScript.Parent = char.LeftHand
	elseif picked == 3 then
		dmgScript.Parent = char.RightFoot
	end
	dmgScript.Disabled = false
	wait(.4)
	dmgScript:Destroy()
	print("Damage was did done did")
end

punchEvent.OnServerEvent:Connect(onPunchFired)

Dmg Script

script.Parent.Touched:Connect(function(hit)	
	local char = hit.Parent
	local hum = char:FindFirstChild("Humanoid")
	if hum and char.Name ~= script.Parent.Parent.Name then
		hum.Health = hum.Health - script.Dmg.Value
		script.Disabled = true
		wait(.5)
		script.Disabled = false
	end
end)

where do i put it or how do i use it?

3 comments

0

Have the sound inside of a Physical PlayerObject, a LocalScript should play this

0

also disabling the script means that the script no longer runs, which means that the wait(.5) and script.Disabled = false never runs

0

also disabling the script means that the script no longer runs, which means that the wait(.5) and script.Disabled = false never runs