I can't seem to figure out how to make a script that bans someone from my game when they touch a brick. I've made a simple admin command before, but I can't seem to figure out how to convert that into a ban onTouch script. Can anyone help?
✓ ANSWER ACCEPTED
Ban script onTouched?
1 answer
✓ Accepted answer
So basically put a "Stringvalue" into the touched brick for this to work and name it String
function onTouch(part)
local player= part.Parent:GetPlayerFromCharacter
local val=script.Parent.String
local valclone=val:Clone()
valclone.Parent=script.Parent
valclone.Value=tostring(player.Name)
game.Players.PlayerAdded:connect(function(plr)
if plr.Name==valclone.Value then
plr:Kick()
end
end
end)
script.Parent.Touched:connect(onTouch)
If this doesn't work, I am sorry, it is off the top of my head.
This discussion is preserved as it was. New answers, comments, and votes are closed.
