Hello! I'm relatively new to scripting and recently learned about remote events, I have two scripts which utilize a remote event that should play a sound effect whenever a player reaches a checkpoint, however whenever I touch the checkpoint it comes up with an error "Failed to load SoundId 131323304: Unable to download sound data".

This is the script, located in ServerScriptService, which fires the client script:

local Stages = workspace:WaitForChild("Stages")
local repStorage = game:GetService("ReplicatedStorage")
local remote = repStorage:WaitForChild("RemoteEvent")

for i, Stage in pairs(Stages:GetChildren()) do

    Stage.Touched:Connect(function(touch)

        local humanoid

        local player = game.Players:GetPlayerFromCharacter(touch.Parent)

        if touch.Parent:FindFirstChild("Humanoid") then

            humanoid = touch.Parent.Humanoid
        end

        if touch.Parent and touch.Parent.Parent:FindFirstChild("Humanoid") then

            humanoid = touch.Parent.Parent.Humanoid
        end

        if humanoid and player then
            local PlayerStage = player.leaderstats.Stage.Value

            if tonumber(Stage.Name) == PlayerStage + 1 then

                player.leaderstats.Stage.Value = player.leaderstats.Stage.Value + 1
				player.leaderstats.Total.Value = player.leaderstats.Total.Value + 1
				remote:FireClient(game.Players:GetPlayerFromCharacter(touch.Parent))
			
			end
        end
    end)
end

This is the LocalScript, located in StarterGui, which should play the sound effect just for the player:

local repStorage = game:GetService("ReplicatedStorage")
local SoundService = game:GetService("SoundService")
local remote = repStorage:WaitForChild("RemoteEvent")

local function playLocalSound(soundId)
	
	local sound = Instance.new("Sound")
	sound.SoundId = soundId
	
	SoundService:PlayLocalSound(sound)
	
	sound.Ended:Wait()
	sound:Destroy()
	
end

remote.OnClientEvent:Connect(function()
	playLocalSound("131323304")
end)

2 comments

0

check that the ID is correct

1

Dont put the id in qoutes