Sound plays then says it doesn't have access

Hey,

i’m making a system where a sound plays everytime a checkpoint is touched. However, the first time when I touch a checkpoint, the sound plays. Then, the next time, it doesn’t play and says it doesn’t have access.
Failed to load sound rbxassetid://18306586465: User is not authorized to access Asset.

Any information on how I would go about fixing this would be greatly appreciated!

1 Like

Hey there! Can I see the script on how you make the sound play? Also I checked the asset and the creator is unverified so that may be part of the problem

Most likely it’s not a public sound or not a sound owned by you. If it’s a sound from a group you own or you own and using it in a group, you’ll have to go into that sounds setting, and enable it being able to be use publicly. Else if it’s a sound privately own from a different game/group/player you won’t be able to use it. Hope this helps.

1 Like

The person can still play the sound first, the second time it will come up with an error.

Hi, are you making a new Sound instance every time you play it, or are you re-using the same instance?

Hi!

Yes I am cloning the sound from ReplicatedStorage and then parenting it to the PlayerGui so it only plays for the player.

I see, so I only have to use a sound from a verified creator?

Also the script:

--server script
local touched = {}

for i, v in ipairs(workspace:GetDescendants()) do
	if v:FindFirstChild("CheckpointValue") then
		v.Touched:Connect(function(hit)
			if hit.Parent:FindFirstChild("Humanoid") then
				local plr = game.Players:GetPlayerFromCharacter(hit.Parent)
				local checkpointNum = v:FindFirstChild("CheckpointValue").Value
				local checkpointName = v.Name
				local checkpointColor = v.BrickColor.Color

				if plr.Character:FindFirstChild("CheckpointValue").Value < checkpointNum then
					plr.Character:FindFirstChild("CheckpointValue").Value = checkpointNum
					plr.Team = game.Teams:FindFirstChild(checkpointName)
					if table.find(touched, plr.UserId) then
						return
					
					else
						game:FindFirstChild("ReplicatedStorage"):FindFirstChild("CheckpointMessage"):FireAllClients(plr, checkpointName, checkpointColor)
						table.insert(touched, plr.UserId)
						game:FindFirstChild("ReplicatedStorage"):FindFirstChild("PlaySound"):FireClient(plr, game:FindFirstChild("ReplicatedStorage"):FindFirstChild("CheckpointSound"))
						--line above is where i send a remote event to the client to play the sound ^^^
					end
				end
			end
		end)
	end
end
--local script
game:FindFirstChild("ReplicatedStorage"):FindFirstChild("PlaySound").OnClientEvent:Connect(function(sound)
	print('received')
	print('its our player')
	print(sound)
	local s = sound:Clone()
	print('cloned')
	s.Parent = game.Players.LocalPlayer.PlayerGui
	print('parented')
	s:Play()
	task.wait(s.TimeLength + 0.75) --delay so the sound truly finishes playing
	s:Destroy()
end)
1 Like

No, just sometimes it is a banned or private asset that can’t be accessed in studio. I thought that would be your problem, but I don’t think it is anymore.

I’m thinking you might want to add a debounce so that you can’t play the same sound twice from the same checkpoint. Also, testing it in the Roblox client, not studio, might fix your issue but I’m not sure

Try put your sound in one of your GUIs in StarterGui, and play it from there using :Play().

That wouldn’t work because it would play for everyone with that GUI active even if they didn’t press the checkpoint

Placing it into one of the GUIs in StarterGui then triggering it with a LocalScript… :man_facepalming:

Oh my bad, I see. @Earthraphobic2, this could fix your problem

Do you mean cloning it and parenting it inside of StarterGui instead of PlayerGui?

The main script already has a debounce for the checkpoint, but thank you for the insight.

Also worked by just using a different sound lolll

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.