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

Failed to load sound, unable to download sound data?

Asked by
TudiPYM 12
3 years ago
Edited 3 years ago

The output states : Failed to load sound 6519564325: Unable to download sound data

local part = script.Parent
local isplaying = false
local soundService = game:GetService("SoundService")
local plr = game.Players.LocalPlayer

local function playLocalSound(soundId)
    if isplaying then 
        return
    end
    isplaying = true
    local sound = soundService.Sound
    sound.SoundId = soundId
    soundService:PlayLocalSound(sound)
    sound.Ended:Wait()
    isplaying = false
end

local function onTouch(hit)
    playLocalSound(6519564325)

    local h = hit.Parent:FindFirstChild("Humanoid")

    if h then 
        local player = game.Players:GetPlayerFromCharacter(hit.Parent)
        if player then
            if player.leaderstats.Grades.Value > 0 then
                local selling = player.leaderstats.Grades
                local getting = player.leaderstats.Money

                getting.Value = getting.Value + selling.Value
                selling.Value = 0
            end
        end
    end
end

part.Touched:Connect(onTouch)

I tried adding "rbxassetid://" but I don't know if it should be a string or anything.

1 answer

Log in to vote
0
Answered by
imKirda 4491 Moderation Voter Community Moderator
3 years ago

You did right by trying to add rbxassetid://, yes, it should be a string, change line 12 to

sound.SoundId = "rbxassetid://" .. soundId
0
Thank you kind sir! TudiPYM 12 — 3y
Ad

Answer this question