Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
0

Sound Effect (On Touch) Not Working what should i do?

Asked by 3 years ago

I have made a script which when a player touches the part the sound is played, but it doesn't work what should i do?

local part = script.Parent


while true do 
 wait(1)
part.Touched:Connect(function(hit)
    local H = hit.Parent:FindFirstChild("Humanoid")
    if H then
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if player then
            local leaderstats = player:WaitForChild("leaderstats")
            local currency = leaderstats.Cash
            local Selling = leaderstats.EPoints
            if Selling.Value > 0 then

                part.Cash:Play()

            end
        end
    end
end)
0
NVM I JUST REALISED I DID NOT NEED THE WHILE LOOP Etrnal_Dev 9 — 3y

Answer this question