Hi Team! - Another super rookie question I’m sure. I’d like to play a sound when a player picks up cash, and only have it heard nearby the pick-up (both by that player and anyone nearby). My method was to clone the sound from serverstorage into every player’s head, then have the sound triggered when the cash is touched. I can confirm my placing of the sound into the player’s head is working, and everything else works with the pickup of the cash, but the sound does not seem to play. Probably missing something simple here. Very much appreciate any suggestions.
Clone Sound into Player Head (works):
local DingSound = game:GetService("ServerStorage"):WaitForChild("MoneyDing")
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
local ClonedMoneyDing = DingSound:Clone()
ClonedMoneyDing.Parent = character.Head
print("Cloned Ding Sound into Player's Head.")
end)
end)
Collect Cash (All works except sound playing)
db = false
script.Parent.Touched:Connect(function(hit)
if not db then
db = true
if hit.Parent:FindFirstChild("Humanoid") then
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
if player then
hit.Parent.Head.MoneyDing:Play()
player.leaderstats.Cash.Value = player.leaderstats.Cash.Value + 25
player.TotalCashEarned.Value = player.leaderstats.Cash.Value + 25
script.Parent.Parent.Part:Destroy()
script.Parent:Destroy()
end
end
wait(2)
db = false
end
end)