The problem:
Despite the sound being a sufficient distance away I am still able to hear the sound, though it seems to only be the start of the sound, It makes a “cracking” sound as if it realises after beginning to play that I shouldn’t be able to hear it.
What I’ve tried:
Other than delaying playing the sound I don’t really know what else to try, I googled it but couldn’t find anything on it and wasn’t even sure what to search.
To clarify, the sound is in the projectile, not the script and this is all local.
Here is the code that plays the sound after detecting a collision though I assume this isn’t the problem:
------------------------------------------------------------------------------------------------------------
---[Locals]-------------------------------------------------------------------------------------------------
local Debounce = false
local Snowball = script.Tracker.Value
------------------------------------------------------------------------------------------------------------
---[Prepare Sounds]-----------------------------------------------------------------------------------------
Snowball.Hit_Land.PlaybackSpeed = math.random(800,1000)/1000
Snowball.Hit_Person.PlaybackSpeed = math.random(800,1000)/1000
------------------------------------------------------------------------------------------------------------
---[Variables]----------------------------------------------------------------------------------------------
local Damage = script.Damage.Value
------------------------------------------------------------------------------------------------------------
---[Hit Detection]------------------------------------------------------------------------------------------
Snowball.Touched:Connect(function(Hit_Part)
if Hit_Part.Parent:FindFirstChild("Humanoid") and Debounce == false and Hit_Part.Parent.Name ~= script.Blacklist.Value then Debounce = true
-- Play snow hit effect
Snowball.Transparency = 1
local HitEffect = Snowball.Hit_Effect
HitEffect.Parent = Hit_Part
HitEffect:Emit(100)
-- Play sound
Snowball.Hit_Person:Play()
-- Send result to server to replicate
local NPC = Hit_Part.Parent
game.ReplicatedStorage.Weapon_Events.Damage_Made:FireServer(Damage,NPC)
-- Wait for sound to finish before cleanup
Snowball.Hit_Person.Ended:wait()
Snowball:Destroy()
script:Destroy()
elseif Debounce == false and Hit_Part.Parent.Name ~= script.Blacklist.Value and Hit_Part.Name ~= "Glass" then Debounce = true
-- Play snow hit effect
Snowball.Transparency = 1
Snowball.Hit_Effect:Emit(100)
-- Play sound
Snowball.Hit_Land:Play()
-- Wait for sound to finish before cleanup
Snowball.Hit_Land.Ended:wait()
Snowball:Destroy()
script:Destroy()
elseif Debounce == false and Hit_Part.Parent.Name ~= script.Blacklist.Value and Hit_Part.Name == "Glass" then Debounce = true
-- Play snow hit effect
Snowball.Transparency = 1
Snowball.Hit_Effect:Emit(100)
-- Send result to server to replicate
local Glass = Hit_Part
game.ReplicatedStorage.Weapon_Events.Glass_Hit:FireServer(Damage,Glass)
-- Play sound
Snowball.Hit_Land:Play()
-- Wait for sound to finish before cleanup
Snowball.Hit_Land.Ended:wait()
Snowball:Destroy()
script:Destroy()
end
end)
Here is the sound Properties:
Here is an example of it happening:
It doesn’t seem to do it with a static object playing the extact same sound instance: