Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How do i make when u collect a coin you can only hear it?

Hello so i been trying to make when you collect a coin you can only hear it (locally) and not the entire server so please somebody send some help

local db = true
script.Parent.Touched:connect(function(hit)
	if hit.Parent:FindFirstChild("Humanoid") ~= nil then
		if db == true then
			db = false
			script.Parent.Transparency = 1
			local player = game.Players:GetPlayerFromCharacter(hit.Parent)
			player.leaderstats.Coins.Value = player.leaderstats.Coins.Value + 5
			script.Sound:Play()
			script.Parent.Transparency = 1
			wait (13)
			db= true
			script.Parent.Transparency = 0
		end
	end	
end)

1 answer

✓ Accepted answer

do a remote event to a local script and in the local script play the sound only you should be able to hear it in a local script if you dont know how to use a remote event go here: https://developer.roblox.com/en-us/articles/Remote-Functions-and-Events

2 comments

0

Yes you put the sound inside a local script so only the local player can hear it and then give the money value through a server script using a remote event.

0

i dont understand but thnaks

This discussion is preserved as it was. New answers, comments, and votes are closed.