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

I just want to remove parts on the client for certain people, how?

Asked by 3 years ago

Hi, I'm trying to remove parts on the client for only 1 person. I've used RemoteEvents, but it didn't work. What is the best way to do this?

1 answer

Log in to vote
1
Answered by
iuclds 720 Moderation Voter
3 years ago
server

local Remote = path.to.remote
local PartToDestroy = path.to.part

local PlayersToRemovePart = {'Player1', 'Player2'}

function foundValueInTable(tbl, value)
    for i,v in pairs(tbl) do
        if v == value then
            return tbl[i]
        end
    end
end

function send()
    for i,v in pairs(game.Players:GetPlayers()) do
        if foundValueInTable(PlayersToRemovePart, v.Name) then
            Remote:FireClient(v, PartToDestroy)
        end
    end
end

-----------------------------

client

local Remote = path.to.remote
Remote.OnClientEvent:Connect(function(part)
    part:Destroy()
end)
0
call send() when you want to remove the part iuclds 720 — 3y
0
change remote to the remote event, change partToDestroy to the part you want to destroy iuclds 720 — 3y
0
add a players name to the playersToRemovePart array iuclds 720 — 3y
0
I already know, thanks! Bankrovers 226 — 3y
0
no problem. iuclds 720 — 3y
Ad

Answer this question