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

How Do I Make A Coin Brick Delete On Each Client, Instead Of Deleting On The Whole Server?

Asked by 6 years ago

When the player touches the coin it removes the coin on the whole server. I want it to remove the coin for the players client.

function onTouch(hit)
    if (script.Parent.got.Value == false) then 
    check = hit.Parent:FindFirstChild("Humanoid")

    if check ~= nil then 
    script.Parent.got.Value = true
    script.Parent.Mesh.Scale = Vector3.new(0,0,0)

        local user = game.Players:GetPlayerFromCharacter(hit.Parent)
        local stats = user.PlayerGui:findFirstChild("Stats")

        if stats ~= nil then 
            local cash = stats:findFirstChild("Coins")---change to money currency
            user.PlayerGui.Stats.Coin.Value = user.PlayerGui.Stats.Coin.Value+1
            local audio = Instance.new("Sound")
            audio.Parent = script.Parent
            audio.SoundId = "http://www.roblox.com/asset/?id=420163794"
            audio:Play()
            wait(1)
            audio:Destroy()

        end 

    end 
    end 
end

script.Parent.Touched:connect(onTouch)
0
Put the coins into CurrentCamera YouSNICKER 131 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Put the coins into the player's camera, or use FilteringEnabled and delete it with LocalScripts, rather than regular scripts.

0
On the wiki it says scripts don't work in camera. And I tried a local script it didn't work. NateDawgGamingRoHD 5 — 6y
0
The LocalScript should be on the client SebbyTheGODKid 198 — 6y
Ad

Answer this question