So, I made this script that transfers "Keys" into "Money", the only issue I'm having right now is that when the "Keys" are sold, It doesn't set "Playing" in the "MoneySound" to true.
script.Parent.Touched:Connect(function(hit) local H = hit.Parent:FindFirstChild("Humanoid") if H then local player = game.Players:GetPlayerFromCharacter(hit.Parent) local Keys = player.leaderstats.Keys local Money = player.leaderstats.Money local MoneySound = game.ReplicatedStorage.Sounds.MoneySound local DeclinedSound = game.ReplicatedStorage.Sounds.Declined if Keys.Value >= 0 then MoneySound:Play() -- This is where i'm having the issue Money.Value = Money.Value + Keys.Value Keys.Value = 0 else game.ReplicatedStorage.Remotevents.CantSell:FireAllClients("Cant sell!") -- this also doesn't work for some reason even though its coded correctly. DeclinedSound:Play() -- This is where i'm having the issue as well end else return end end)
Oh and I forgot to include this, but if the player doesn't have more than 0 keys, a declined sound will play, however, this also doesn't play. No, It's not my headphones, because the background music works. There are also no errors in the output. Please no useless one-word answers, I've already tried them all. Help needed!
try to set timeposition before you play it, maybe volume.
MoneySound.TimePosition = 0 MoneySound.Volume = 0 MoneySound:Play()
If this does not work, it may be problem of sound location, try to place them at workspace or somewhere else.