So I’m trying to make a script that kicks blacklisted group people when they join but for some reason it does some weird health animation, I tried to make it work without the animation but I don’t know how to kick the player without doing the health animation this is the script and video proof:sob: I hope you please help me because this broke my heart (Btw it doesn’t kick too) (there’s no error warning)
local data = game:GetService("DataStoreService"):GetDataStore(game.PlaceId)
game.Players.PlayerAdded:Connect(function(player)
player.CharacterAdded:Connect(function(character)
if player:IsInGroup(16615541) then
Kick(character, player)
end
end)
end)
function Kick(chr, plr)
local humanoid = chr:FindFirstChild("Humanoid")
repeat task.wait()
humanoid.Health -= 1
data:SetAsync(plr.UserId .. "health", humanoid.Health)
until data:GetAsync(plr.UserId .. "health") == 0
humanoid.Died:Connect(function()
plr:Kick("Your role is " .. plr:GetRoleInGroup(16615541) .. " in blacklisted group")
end)
end