I have a part that when touched temporarily gives the player super speed.
It also triggers a “speed” sound to support the effect.
However, the sound is playing from the part touched.
I need the sound to emit from the actual player.
Any help here is greatly appreciated.
Here’s what I have currently:
local l = script.Parent
local sound = script.Parent["Sound Effect -- Electrical Shock Sound"]
local l = script.Parent
l.Touched:connect(function(hit)
local human = hit.Parent:FindFirstChild("Humanoid")
if human then
human.WalkSpeed = 150
sound:Play()
wait(8)
human.WalkSpeed = 16
end
end)
local l = script.Parent
local sound = script.Parent["Sound Effect -- Electrical Shock Sound"]
local check = false
l.Touched:connect(function(hit)
if check == false then
local human = hit.Parent:FindFirstChild("Humanoid")
if human then
local Csound = sound:Clone()
human.WalkSpeed = 150
Csound.Parent = human.Parent.HumanoidRootPart
Csound:Play()
check = true
wait(8)
human.WalkSpeed = 16
Csound:Destroy()
check = false
end
end
end)
local Part = script.Parent
local Sound = Part:FindFirstChild("Sound Effect -- Electrical Shock Sound")
Part.Touched:Connect(function(Hit)
local Humanoid = Hit.Parent:FindFirstChild("Humanoid")
if Humanoid then
local NewSound = Sound:Clone() --Clone the sound
NewSound.Parent = Humanoid.Parent:FindFirstChild("Head") --Parent the sound to character's head
NewSound:Play() --Play the sound
Humanoid.WalkSpeed = 150
wait(8)
Humanoid.WalkSpeed = 16
end
end)