Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

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

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

✓ Accepted answer
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)

5 comments

0

call send() when you want to remove the part

0

change remote to the remote event, change partToDestroy to the part you want to destroy

0

add a players name to the playersToRemovePart array

0

I already know, thanks!

0

no problem.

This discussion is preserved as it was. New answers, comments, and votes are closed.