im making a brick that kicks you but its very laggy with brick and it keeps `printing: 15:42:48.173 - Stack Begin
15:42:48.175 - Script 'Workspace.KickBrick.Script', Line 6
15:42:48.177 - Stack End`
but it does kick you, any help is very admired
script.Parent.Touched:Connect(function(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if hit.Parent == plr then plr:Kick("Congrats on doing the secret, you got to do it again once badge is ready"..plr.Name.."DON'T TELL ANYBODY") else plr:Kick("Error 232 "..plr.Name.." Were Truly Sorry.") end end)
The problem is, without a debounce it will keep firing the .Touched event, thus making it very laggy. To fix it, of course, use a debounce:
local debounce = true script.Parent.Touched:Connect(function(hit) local plr = game.Players:GetPlayerFromCharacter(hit.Parent) if plr then if debounce then debounce = false plr:Kick("Congrats on doing the secret, you got to do it again once badge is ready"..plr.Name.."DON'T TELL ANYBODY") else plr:Kick("Error 232 "..plr.Name.." Were Truly Sorry.") end end debounce = true end)
Take away the if hit.Parent == plr line and replace it with
if plr then
-Ducky
Developer
Youtuber