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

In my personal server how can i ban C4's?

Asked by 10 years ago

Please include the code which you are trying to use, so the community will be better-equipped to help you with your problem.

In my personal server C4's crash the game if used how can i ban them or get rid of them?

4 answers

Log in to vote
0
Answered by
Mowblow 117
10 years ago

Please provide explanation with your answers. Simply posting code does not spread knowledge of integral scripting processes which helps people understand the logic and reasoning behind your answer.

So you can ban more than C4!

local notallowed = {"C4", "MoreThingsYouWantToBan","TypeIt'sNameHere"}

game.Workspace.DecendantAdded:connect(function(child)
if child.Name == notallowed and game.Players:GetPlayerFromCharacter(child) == nil then
child:Destroy()
end)

I have not tested this script. It should work though.

0
Descendant* OniiCh_n 410 — 10y
0
Yeah, missed that. Say, did I reference the table correctly in the "if" statement? Mowblow 117 — 10y
0
No, if you were to do it that way it would require m Archonious2 160 — 10y
0
a metatable* Archonious2 160 — 10y
Ad
Log in to vote
0
Answered by 10 years ago

Quick yet inefficient way to do this -Add everything to table that you made in the game, then check with if anything else was added and destroy it.

Log in to vote
0
Answered by 10 years ago

Or you could always do something like this.

game.Workspace.DescendentAdded:connect(function(item)
    if item.Name == "whatever C4 is called when it's inserted [check this] then
        item:Remove()
    end
end)

--MightyWanderer

1
Remove() is deprecated, use Destroy() instead. Archonious2 160 — 10y
Log in to vote
0
Answered by 10 years ago

Thanks all.

Answer this question