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

how can i change this destroy script so it only destroys for the person who touched it?

Asked by 6 years ago

here is the script that makes the block destroy and it also gives the player who touches it money

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.PowerBlocks.Value = player.leaderstats.PowerBlocks.Value + 1
        end
    end
end)

i need to make it so it only disappears for the person who touched it

thanks

0
if this is a server script, then you'd need to use remote events for the client to destroy the brick User#23365 30 — 6y
0
TouchEnded DeceptiveCaster 3761 — 6y

1 answer

Log in to vote
0
Answered by
zValerian 108
6 years ago

Put that entire script into a local script in the part. It will also make it easier because you can use LocalPlayer aswell then.

Ad

Answer this question