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

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

Asked by 4 years ago

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

Log in to vote
1
Answered by 4 years ago

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

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. JustinWe12 723 — 4y
0
i dont understand but thnaks SnekyGodZ 19 — 4y
Ad

Answer this question