Hi. I've created a very simple script, where if you touch the parent, it kicks your client:
script.Parent.Touched:Connect(function(hit)
local player = game.Players:GetPlayerFromCharacter(hit.Parent)
player:Kick("You have been kicked.")
end)
Now, with another script, I destroy the script with a LocalScript (StarterPlayer>StarterPlayerScripts):
local whitelist = {"namehere"}
local plr = game:GetService("Players").LocalPlayer
if table.find(whitelist, plr.Name) then
game.Workspace.Brick:Destroy()
return;
end
This deletes it on the client, but if I die or reset my character while standing where the brick would be, it kicks me as if it was still there.
How do I kill the script?

11 comments
So, do you want to kill the script locally or in server?
Locally
If you kill a script locally, it will reset on respawn. So, you have to keep destroying it in a loop on respawn
I tried using a while wait() loop and it didnt seem to work. Is there any way of looping that you reccomend?
Here's the new script after i added a loop
local whitelist = {"namehere"} local plr = game:GetService("Players").LocalPlayer if table.find(whitelist, plr.Name) then while wait() do game.Workspace.anti:Destroy() end return; end
I added an answer try checking that out
When a character dies, the old character model gets swapped with a new one, and the script will still be there! Try checking whether the part is not equal to nil if it is then destroy it.
Try using a loop to stimulate that.
Tried using what you said and it still kicked when I reset.
If you are using a loop you could simply use break. If not :Destroy() is the only option.