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

How Do I Convert This onTouched Script To Filtering Enabled?

Asked by 6 years ago

So this script is placed into a coin where when a player touches the coin, he collects it and removes the coin. It does however work in studio.. but when I go in game.. It doesn't work. Each coin is called "Coin". Here is the code.

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
Is there anything in the output? Conquesias 85 — 6y
0
Nope. :/ NateDawgGamingRoHD 5 — 6y
0
Since I need the coins to be client sided... Each "Coin" is in a model called "Coins" in starterpack. NateDawgGamingRoHD 5 — 6y
0
^ Thats your problem. Just place the model in Workspace and Clone each coin from the client. Crazycat4360 115 — 6y
View all comments (3 more)
0
But whenever a player touches the coin in workspace it deletes the coin in the whole server for everyone. I only want it to delete for the player's client. NateDawgGamingRoHD 5 — 6y
0
Do FireClient() and in that client script it deletes it (this wont affect the other clients) decla123 45 — 6y
0
But all the coins are called "Coin" How would it delete that specific one?? NateDawgGamingRoHD 5 — 6y

1 answer

Log in to vote
0
Answered by 6 years ago

Bummp

Ad

Answer this question