How to make a part kick a player

hello im trying to make make it so that if a player touches a part they get kicked but im having problems, sometimes it will just kick player the moment the player enters game or it just doesnt work

script.Parent.Touched:Connect(function(hit)
	local playe = hit.Parent:FindFirstChild("Humanoid")
	game:GetService("Players").PlayerAdded:Connect(function(playe)
		

	playe.Players:Connect(function(char)
	char:WaitForChild("Humanoid").Touched:Connect(function()
	playe:Kick("Trolled")
				
			end)
		end)
	end)
end)

script.Parent.Touched:Connect(function(hit)
	local player = hit.Parent:FindFirstChild("Humanoid")
	if player then
		local real =game:GetService("Players"):GetPlayerFromCharacter(hit.Parent)
		if real then
			real:Kick("trolled")
		end	
	end
end)
1 Like